mb_convert_encoding在PHP俄罗斯(mb_convert_encoding for

2019-07-30 21:20发布

如何使用mb_convert_encoding或任何其他方法俄文字符转换为UTF-8 PHP?

Answer 1:

你尝试以下? 不知道这工作的。

mb_convert_encoding($str, 'UTF-8', 'auto');


Answer 2:

$file = 'images/да так 1.jpg';//this is in UTF-8, needs to be system encoding (Russian)
$new_filename = mb_convert_encoding($file, "Windows-1251", "utf-8");//turn utf-8 to system encoding Windows-1251 (Russian)

现在你的俄语文件应该在PHP中打开你的俄语字符已经是UTF-8,你需要做的是在相同的编码类型,系统编码有名字

或者如果您需要相反的...

$new_filename = mb_convert_encoding($file, "utf-8", "Windows-1251");


文章来源: mb_convert_encoding for russian in php