1
我想编一个字符串到utf8
编码,但我不知道原始字符集是什么。如何将字符串更改为utf8编码?
字符串的原始字符集可能是GBK
,iso-8859-1
或其他我不知道的字符串。
我用mb_detect_encoding($content, 'UTF-8', true)
和iconv($original, "UTF-8", $content);
如何获得原始编码?
我想编一个字符串到utf8
编码,但我不知道原始字符集是什么。如何将字符串更改为utf8编码?
字符串的原始字符集可能是GBK
,iso-8859-1
或其他我不知道的字符串。
我用mb_detect_encoding($content, 'UTF-8', true)
和iconv($original, "UTF-8", $content);
如何获得原始编码?
你读过[了'mb_detect_encoding()'文档】(http://php.net/manual/en/function.mb-detect-encoding.php)? 'mb_detect_encoding($ content,'UTF-8',true)'没有任何意义。 – lanzz
然后你尝试'mb_detect_encoding($ content,'auto',true)'。需要警告的是,在任何情况下都没有办法正确检测您的编码,因为它更像是一个猜测过程。 – HerrSerker