繁体   English   中英

mb_convert_encoding在PHP中使用俄语

[英]mb_convert_encoding for russian in php

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

您尝试了以下吗? 不过,不确定是否可行。

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 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM