【发布时间】:2009-07-27 11:29:16
【问题描述】:
如何在 PHP 中使用 mb_convert_encoding 或任何其他方法将俄语字符转换为 utf-8?
【问题讨论】:
标签: php utf-8 character-encoding cyrillic
如何在 PHP 中使用 mb_convert_encoding 或任何其他方法将俄语字符转换为 utf-8?
【问题讨论】:
标签: php utf-8 character-encoding cyrillic
您是否尝试过以下操作?不过不确定它是否有效。
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");
【讨论】: