37 if($codepoint < 0x80)
return chr($codepoint);
38 if($codepoint < 0x800)
return chr($codepoint >> 6 & 0x3f | 0xc0) .
39 chr($codepoint & 0x3f | 0x80);
40 if($codepoint < 0x10000)
return chr($codepoint >> 12 & 0x0f | 0xe0) .
41 chr($codepoint >> 6 & 0x3f | 0x80) .
42 chr($codepoint & 0x3f | 0x80);
43 if($codepoint < 0x110000)
return chr($codepoint >> 18 & 0x07 | 0xf0) .
44 chr($codepoint >> 12 & 0x3f | 0x80) .
45 chr($codepoint >> 6 & 0x3f | 0x80) .
46 chr($codepoint & 0x3f | 0x80);
48 echo
"Asked for code outside of range ($codepoint)\n";
63 foreach( explode(
' ', $sequence )
as $hex ) {
80 foreach ( preg_split(
'//u', $str, -1, PREG_SPLIT_NO_EMPTY )
as $cp ) {
107 if ( $length != strlen( $char ) ) {
110 if ( $length == 1 ) {
114 # Mask off the length-determining bits and shift back to the original location
118 # Add in the free bits from subsequent bytes
119 for ( $i=1; $i < $length; $i++ ) {
121 $z |= ord( $char[$i] ) & 0x3f;
135 return strtr( $string,