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

有帮助吗?

解决方案

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

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

其他提示

$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");
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top