mb_convert_encoding for russian in php
Asked Answered
M

2

7

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

Mcmullin answered 27/7, 2009 at 11:29 Comment(0)
B
7

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

mb_convert_encoding($str, 'UTF-8', 'auto');
Boating answered 27/7, 2009 at 11:34 Comment(3)
äÁÎÎÙÅ ÂÙÌÉ ÏÂÎÏ×ÌÅÎÙ ?? do you know which encoding is this?? this is a russian translation for "Data has been refreshed. mb_convert_encoding($str, 'UTF-8', 'auto'); not workingMcmullin
Maybe 2cyr.com/decode/?lang=en can help you figure out what encoding it is. Guess it is koi8...Boating
Please, use some modified mb_convert_encoding($str, 'UTF-8', mb_detect_encoding($str))Campinas
A
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");
Archbishopric answered 26/10, 2009 at 8:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.