I have a small html code and I need to convert it to UTF-8.
I use this iconv("windows-1251", "utf-8", $html);
All text converts correctly, but if text for example in tag <i>...</i>
, then it don't convert text and I see somethig like this Показать мн
You know, message like
Показать мн
you see if encoding for page iswindows-1251
, but text encoded inutf-8
.I saw this problem in one of my project, so just change change encoding for page in
utf-8
and this text will shown correctly.Let me take you some examples:
if page in
utf-8
, but text inwindows-1251
you wil see something like this:???? ?? ?????? ??? ????? ??? ??????? ?? ????? ???? ??? ?????
if page in
windows-1251
, but text inutf-8
you see this:"Мобильные телефоны";"Apple iPhone 4
If you have access to the Multibye package, you can try it. See the PHP page here: http://www.php.net/manual/en/function.mb-convert-encoding.php
I always use manual convertation (character-by-character), like this:
p.s. dont forget, the .php file encoding should be UTF8. also, in the head of HTML,insert standard declaration for UTF8
Most of the solutions lack conversion to single-byte encoding. I use mb_convert_encoding($string,'windows-1251') to convert from UTF-8 in my case.
try this, works for me!