[ Index ] |
PHP Cross Reference of DokuWiki |
[Source view] [Print] [Project Stats]
(no description)
File Size: | 246 lines (10 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
fromUtf8($str, $strict = false) X-Ref |
Takes an UTF-8 string and returns an array of ints representing the Unicode characters. Astral planes are supported ie. the ints in the output can be > 0xFFFF. Occurrances of the BOM are ignored. Surrogates are not allowed. If $strict is set to true the function returns false if the input string isn't a valid UTF-8 octet sequence and raises a PHP error at level E_USER_WARNING Note: this function has been modified slightly in this library to trigger errors on encountering bad bytes link: http://hsivonen.iki.fi/php-utf8/ link: http://sourceforge.net/projects/phputf8/ return: mixed array of unicode code points or false if UTF-8 invalid param: string $str UTF-8 encoded string param: boolean $strict Check for invalid sequences? author: <hsivonen@iki.fi> author: Harry Fuecks <hfuecks@gmail.com> see: unicode_to_utf8 |
toUtf8($arr, $strict = false) X-Ref |
Takes an array of ints representing the Unicode characters and returns a UTF-8 string. Astral planes are supported ie. the ints in the input can be > 0xFFFF. Occurrances of the BOM are ignored. Surrogates are not allowed. If $strict is set to true the function returns false if the input array contains ints that represent surrogates or are outside the Unicode range and raises a PHP error at level E_USER_WARNING Note: this function has been modified slightly in this library to use output buffering to concatenate the UTF-8 string (faster) as well as reference the array by it's keys link: http://hsivonen.iki.fi/php-utf8/ link: http://sourceforge.net/projects/phputf8/ return: string|false UTF-8 string or false if array contains invalid code points param: array $arr of unicode code points representing a string param: boolean $strict Check for invalid sequences? author: <hsivonen@iki.fi> author: Harry Fuecks <hfuecks@gmail.com> see: utf8_to_unicode |