/functions/decode/utf_8.php

Description

functions/decode/utf-8.php - utf-8 decoding functions

This file contains utf-8 decoding function that is needed to read utf-8 encoded mails in non-utf-8 locale.

Every decoded character consists of n bytes. First byte is octal 300-375, other bytes - always octals 200-277.

 Ranges (first byte):
                oct     dec    hex
 Two byte   - 300-337 192-223 C0-DF
 Three byte - 340-357 224-239 E0-EF
 Four byte  - 360-367 240-247 F0-F7
 Five byte  - 370-373 248-251 F8-FB
 Six byte   - 374-375 252-253 FC-FD

 \a\b characters are decoded to html code calculated with formula:
  octdec(a-300)*64 + octdec(b-200)

 \a\b\c characters are decoded to html code calculated with formula:
  octdec(a-340)*64^2 + octdec(b-200)*64 + octdec(c-200)

 \a\b\c\d characters are decoded to html code calculated with formula:
  octdec(a-360)*64^3 + octdec(b-200)*64^2 +
  + octdec(c-200)*64 + octdec(d-200)

 \a\b\c\d\e characters are decoded to html code calculated with formula:
  octdec(a-370)*64^4 + octdec(b-200)*64^3 +
  + octdec(c-200)*64^2 + octdec(d-200)*64 + octdec(e-200)

 \a\b\c\d\e\f characters are decoded to html code calculated with formula:
  octdec(a-374)*64^5 + octdec(b-200)*64^4 + octdec(c-200)*64^3 +
  + octdec(d-200)*64^2 + octdec(e-200)*64 + octdec(f-200)

Functions
charset_decode_utf_8 (line 50)

Decode utf-8 strings

  • return: Decoded string
string charset_decode_utf_8 (string $string)
  • string $string: Encoded string

Documentation generated on Tue, 23 Dec 2014 04:19:41 +0100 by phpDocumentor 1.4.3