有谁理解编码知识,utf-8,gbk,big2,unicode 之间的转换?请高手帮忙啊
function CHSUtoUTF8($c)
{
$str='';
if ($c < 0x80)
{
$str .= $c;
}
elseif ($c < 0x800)
{
$str .= (0xC0 | $c >> 6);
$str .= (0x80 | $c & 0x3F);
}
elseif ($c < 0x10000)
{
$str .= (0xE0 | $c >> 12);
$str .= (0x80 | $c >> 6 & 0x3F);
$str .= (0x80 | $c & 0x3F);
}
elseif ($c < 0x200000)
{
$str .= (0xF0 | $c >> 18);
$str .= (0x80 | $c >> 12 & 0x3F);
$str .= (0x80 | $c >> 6 & 0x3F);
$str .= (0x80 | $c & 0x3F);
}
return $str;
}
QQ:1302781404
希望能够解决!
------解决方案--------------------你写的这个有问题?
------解决方案--------------------
编码转换的过程是
1)先解码-》再用另一种方式去编码