求iconv的替代函数
网上找了下,没对照表,求一个,最好自己试过的,发我邮箱吧amani1234#21cn.com,谢谢
------解决方案--------------------
/******************************* //GB转UTF-8编码 *******************************/ 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,15)) { $CODETABLE[hexdec(substr($l, 0, 6))] = substr($l, 7, 6); } fclose($fp); } $ret = ""; $utf8 = ""; while ($gbstr) { if (ord(substr($gbstr, 0, 1)) > 127) { $thisW = substr($gbstr, 0, 2); $gbstr = substr($gbstr, 2, strlen($gbstr)); $utf8 = ""; @$utf8 = u2utf8(hexdec($CODETABLE[hexdec(bin2hex($thisW)) - 0x8080])); if($utf8!=""){ for ($i = 0;$i > 6); $str .= (0x80 | $c & 0x3F); } else if ($c > 12); $str .= (0x80 | $c >> 6 & 0x3F); $str .= (0x80 | $c & 0x3F); } else if ($c > 18); $str .= (0x80 | $c >> 12 & 0x3F); $str .= (0x80 | $c >> 6 & 0x3F); $str .= (0x80 | $c & 0x3F); } return $str; } <br><font color="#e78608">------解决方案--------------------</font><br>楼主看下这个帖子:http://neture.homeip.net/digiland/viewtopic.php?pid=39<br>下蒌地址osc_iconv.zip<br>里面有对照表的<br><br>如果需要非要使用,建议在php中打开iconv吧。 <br><font color="#e78608">------解决方案--------------------</font><br>建议还是不要自己写了 <br><font color="#e78608">------解决方案--------------------</font><br>强烈建议使用内置的,自己写对照表肯定不全<br>iconv 能处理的字符集有很多,自己写的肯定不能全包括 <div class="clear"> </div>