Hi guys. I always had problems with iconv. Now I have to convert the string to Windows-1250, and this does not work:
$string = "ľaľa ho papľuha, ogrcal mi krpce!"; echo $string . ' ( ' . mb_detect_encoding($string) . ' ) <br>'; $string_encoded = iconv( mb_detect_encoding( $string ), 'Windows-1250//TRANSLIT', $string ); echo $string_encoded . ' ( ' . mb_detect_encoding($string_encoded) . ' ) <br>'; $string_encoded = mb_convert_encoding( $string, 'Windows-1250' ); echo $string_encoded . ' ( ' . mb_detect_encoding($string_encoded) . ' ) <br>';
The three echoes above display exactly this:
ľaľa ho papľuha, ogrcal mi krpce! ( UTF-8 ) a a ho pap uha, ogrcal mi krpce! ( ) mb_convert_encoding() Unknown encoding "Windows-1250" ( ASCII )
Since I always saw this diamond question, I wonder if this php function works at all. How to convert UTF-8 to Windows-1250?
- File was saved in notepad ++ in UTF-8
- I also tried the header ('Content-Type: text / html; charset = windows-1250'); and setLocale ()
source share