6

如何使用 mb_convert_encoding 或任何其他方法在 PHP 中将俄语字符转换为 utf-8?

4

2 回答 2

7

您是否尝试过以下操作?不过,不确定它是否有效。

mb_convert_encoding($str, 'UTF-8', 'auto');
于 2009-07-27T11:34:16.650 回答
1
$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");
于 2009-10-26T08:47:29.953 回答