Index: trunk/phase3/includes/AjaxFunctions.php |
— | — | @@ -36,7 +36,7 @@ |
37 | 37 | $pos++; |
38 | 38 | $unicodeHexVal = substr ( $source, $pos, 4 ); |
39 | 39 | $unicode = hexdec ( $unicodeHexVal ); |
40 | | - $decodedStr .= code2utf( $unicode ); |
| 40 | + $decodedStr .= codepointToUtf8( $unicode ); |
41 | 41 | $pos += 4; |
42 | 42 | } else { |
43 | 43 | // we have an escaped ascii character |
— | — | @@ -56,30 +56,3 @@ |
57 | 57 | |
58 | 58 | return $decodedStr; |
59 | 59 | } |
60 | | - |
61 | | -/** |
62 | | - * Function coverts number of utf char into that character. |
63 | | - * Function taken from: http://www.php.net/manual/en/function.utf8-encode.php#49336 |
64 | | - * |
65 | | - * @param $num Integer |
66 | | - * @return utf8char |
67 | | - */ |
68 | | -function code2utf( $num ) { |
69 | | - if ( $num < 128 ) { |
70 | | - return chr( $num ); |
71 | | - } |
72 | | - |
73 | | - if ( $num < 2048 ) { |
74 | | - return chr( ( $num >> 6 ) + 192 ) . chr( ( $num&63 ) + 128 ); |
75 | | - } |
76 | | - |
77 | | - if ( $num < 65536 ) { |
78 | | - return chr( ( $num >> 12 ) + 224 ) . chr( ( ( $num >> 6 )&63 ) + 128 ) . chr( ( $num&63 ) + 128 ); |
79 | | - } |
80 | | - |
81 | | - if ( $num < 2097152 ) { |
82 | | - return chr( ( $num >> 18 ) + 240 ) . chr( ( ( $num >> 12 )&63 ) + 128 ) . chr( ( ( $num >> 6 )&63 ) + 128 ) . chr( ( $num&63 ) + 128 ); |
83 | | - } |
84 | | - |
85 | | - return ''; |
86 | | -} |