mb_convert_encoding for russian in php

本小妞迷上赌 提交于 2020-01-12 19:02:08

问题


how to convert Russian character to utf-8 in PHP using mb_convert_encoding or any other method?


回答1:


Did you try the following? Not sure if it works, though.

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



回答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)

now your russian files should open your russian characters in php are already utf-8 what you need to do is have the name in the same encoding type as your system encoding

or if you need the opposite...

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


来源:https://stackoverflow.com/questions/1187652/mb-convert-encoding-for-russian-in-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!