iconv_get_encoding — Get current setting for character encoding 
conversion
iconv_set_encoding — Set current setting for character encoding conversion
iconv — Convert string to requested character encoding
ob_iconv_handler — Convert character encoding as output buffer handler

解决方案 »

  1.   

    mb_string包是日本人开发的,用mb_convert_encoding应该不会有问题。
    何必要自己开发一组呢?改天国人要是开发一个cn_string包,我肯定要扬弃自己开发的中文处理函数的!
    一定要自己研究一下,可以到网上找一下相关的代码页。里面是与语言编码到unicode编码的对照表。很容易开发出自己的程序的。
      

  2.   

    function toutf8($string){
    $index="0x";
    $index.=dechex(hexdec(bin2hex($string)));

    $c=hexdec($GLOBALS["codetable"][$index]);
    $str=""; 
    if ($c < 0x80) { 
    $str.=$c; 

    else if ($c < 0x800) { 
    $str.=chr(0xC0 | $c>>6); 
    $str.=chr(0x80 | $c & 0x3F); 

    else if ($c < 0x10000) { 
    $str.=chr(0xE0 | $c>>12); 
    $str.=chr(0x80 | $c>>6 & 0x3F); 
    $str.=chr(0x80 | $c & 0x3F); 

    else if ($c < 0x200000) { 
    $str.=chr(0xF0 | $c>>18); 
    $str.=chr(0x80 | $c>>12 & 0x3F); 
    $str.=chr(0x80 | $c>>6 & 0x3F); 
    $str.=chr(0x80 | $c & 0x3F); 

    return $str; 
    } function gb2utf8($string){
    $str=$string;
    $utf8="";
    while($str){
    if(ord(substr($str,0,1))>0x7f){
    $utf8.=toutf8(substr($str,0,2));
    $str=substr($str,2,strlen($str)-2);
    }
    else{
    $utf8.=substr($str,0,1);
    $str=substr($str,1,strlen($str)-1);
    }

    }
    return $utf8;
    }以上,是一个到汉字到utf8的实现,
    那么euc到sjis的实现,该如何做呢?