PHP Ansi 转 UTF-8
我正在尝试用 PHP 创建一个脚本来将一些文件转换为 UTF-8。我有一个希腊语文件,其中 Notepad++ 表明它是“ANSI”编码。当我将其上传到服务器时,它检测到它的编码为UTF-8(我认为是这样)。然后,当我使用 utf8_encode () 将其内容转换为 UTF-8 并下载新文件时,字符混乱了。我尝试用PHP去掉BOM,结果是一样的。我尝试使用 PHP 删除 BOM,而不将文件转换为 UTF-8,但文件仍保持 ANSI 编码,没有混乱的字符。我该如何解决这个问题?
I'm trying to create a script in PHP for converting some files to UTF-8. I have a file in Greek, where Notepad++ indicates that it ahs "ANSI" encoding. When I upload it to the server, it detects it's encoding as UTF-8 (something wrinf i think). Then when I convert it's contents to UTF-8 with utf8_encode () and download the new file, the characters are messed up. I tried to remove the BOM with PHP and the result was the same. I tried to remove the BOM with PHP without converting the file to UTF-8 but the file remained in ANSI encoding, without messed up characters. How can I fix that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
删除 BOM,然后执行以下操作:
将
greek-charset
更改为正确的字符集名称(可能是Windows-1253
)。Remove BOM, then do:
Change
greek-charset
to correct name of charset (maybeWindows-1253
).