An alternative function for finding iconv
Online to find the next, no comparison table, ask for a, the best of their own tried, send me mailbox amani1234#21cn.com, thank you
------Solution--------------------
PHP Code
/*******************************//GB to UTF-8 encoded *******************************/function Gb2utf8 ($GBSTR) {global $ codetable; if (Trim ($gbstr) = = "") return $gbstr; if (empty ($CODETABLE)) {$filename = DirName (__file__). " /gb2312-utf8.table "; $fp = fopen ($filename, "R"); while ($l = Fgets ($fp, +)) {$CODETABLE [Hexdec (substr ($l, 0, 6)] = substr ($l, 7, 6);} Fclose ($FP); } $ret = ""; $utf 8 = ""; while ($GBSTR) {if (Ord (substr ($gbstr, 0, 1)) > 127) {$thisW = substr ($gbstr, 0, 2); $gbstr = substr ($gbstr, 2, strlen ($GBSTR)); $utf 8 = ""; @ $utf 8 = U2utf8 (Hexdec ($CODETABLE [Hexdec (Bin2Hex ($thisW))-0x8080])); if ($utf 8!= "") {for ($i = 0; $i < strlen ($utf 8); $i + 3) $ret. = Chr (substr ($utf 8, $i, 3)); }} else {$ret. = substr ($gbstr, 0, 1); $gbstr = substr ($gbstr, 1, strlen ($GBSTR)); }} return $ret;} Unicode goto utf8function U2utf8 ($c) {for ($i = 0; $i < count ($c); $i + +) $str = ""; if ($c < 0x80) {$str. = $c;} else if ($c < 0x800) {$str. = (0xC0 | $c;> 6); $str. = (0x80 | $c & 0x3F); } else if ($c < 0x10000) {$str. = (0xE0 | $c >> 12); $str. = (0x80 | $c >> 6 & 0x3F); $str. = (0x80 | $c & 0x3F); } else if ($c < 0x200000) {$str. = (0xF0 | $c >> 18); $str. = (0x80 | $c >> & 0x3F); $str. = (0x80 | $c >> 6 & 0x3F); $str. = (0x80 | $c & 0x3F); } return $str;}
------Solution--------------------
Landlord look at this post: http://neture.homeip.net/digiland/viewtopic.php?pid=39
Download the address Osc_iconv.zip
There's a chart in there.
If you need to use it, it is recommended to open Iconv in PHP.
------Solution--------------------
I suggest you don't write it yourself.
------Solution--------------------
It is strongly recommended to use the built-in, write your own table definitely not all
Iconv can handle a lot of character sets, their own writing must not include all