Pau*_*xon 18
看起来你最初有一个UTF-8文件,它被解释为8位编码(例如ISO-8859-15)和实体编码.我这样说是因为序列C3A9看起来像一个非常合理的UTF-8编码序列.
您将需要首先对其进行实体解码,然后再次使用UTF-8编码.然后,您可以使用像iconv这样的内容转换为您选择的编码.
要完成您的示例:
你提到想用PHP来处理这个问题,这样的事情可能适合你:
//to load from a file, use
//$file=file_get_contents("/path/to/filename.txt");
//example below uses a literal string to demonstrate technique...
$file="&Précédent is a French word";
$utf8=html_entity_decode($file);
$iso8859=utf8_decode($utf8);
//$utf8 contains "Précédent is a French word" in UTF-8
//$iso8859 contains "Précédent is a French word" in ISO-8859
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16737 次 |
| 最近记录: |