Login   Register  
PHP Classes
elePHPant
Icontem

ISO-8859-2 to UTF8-Problem

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      UTF8  >  All threads  >  ISO-8859-2 to UTF8-Problem  >  (Un) Subscribe thread alerts  
Subject:ISO-8859-2 to UTF8-Problem
Summary:Not all chars correctly converted
Messages:5
Author:Jörg Spieler
Date:2005-01-06 15:10:13
Update:2005-01-08 10:20:11
 

  1. ISO-8859-2 to UTF8-Problem   Reply  
Picture of Jörg Spieler
Jörg Spieler
2005-01-06 15:10:14
I've tried to convert a string from polish ISO-8859-2 to UTF8.

$utfConverter = new utf8(CP1252);
$text = $utfConverter->strToUtf8($text);

result:
Odznacza się wysok± smakowito¶ci±,

when I try this:

$tekscik = $text;
$tekscik = str_replace("±", "\xC4\x85", $tekscik);
$tekscik = str_replace('¡', "\xC4\x84", $tekscik);
$tekscik = str_replace('æ', "\xC4\x87", $tekscik);
$tekscik = str_replace('Æ', "\xC4\x86", $tekscik);
$tekscik = str_replace('ê', "\xC4\x99", $tekscik);
$tekscik = str_replace('Ê', "\xC4\x98", $tekscik);
$tekscik = str_replace('³', "\xC5\x82", $tekscik);
$tekscik = str_replace('£', "\xC5\x81", $tekscik);
$tekscik = str_replace('ó', "\xC3\xB3", $tekscik);
$tekscik = str_replace('Ó', "\xC3\x93", $tekscik);
$tekscik = str_replace('¶', "\xC5\x9B", $tekscik);
$tekscik = str_replace('¦', "\xC5\x9A", $tekscik);
$tekscik = str_replace('¼', "\xC5\xBC", $tekscik);
$tekscik = str_replace('¬', "\xC5\xBB", $tekscik);
$tekscik = str_replace('¿', "\xC5\xBA", $tekscik);
$tekscik = str_replace('¯', "\xC5\xB9", $tekscik);
$text = $tekscik;

(php.net-example)

I've got this correct result:
Odznacza się wysoką smakowitością,

Is there a bug?

  2. Re: ISO-8859-2 to UTF8-Problem   Reply  
Picture of Alexandar Minkovsky
Alexandar Minkovsky
2005-01-06 15:47:29 - In reply to message 1 from Jörg Spieler
Hi,
I'm not sure if this is a bug.
Pasting differently encoded text in a forum should not work, so I don't have test data :)
Can You attach to an email a CP1252 encoded .txt file with the text that does not convert properly and send it to me so that I can test it? It would be good as well if You provide me with the UTF-8 encoded version of the same file, produced by an independent tool, so that I can compare results.

Regards,

Alex

  3. Re: ISO-8859-2 to UTF8-Problem   Reply  
Picture of Jörg Spieler
Jörg Spieler
2005-01-06 16:00:35 - In reply to message 2 from Alexandar Minkovsky
ok, I'll try!

Thank ya for that fast responding.

  4. Re: ISO-8859-2 to UTF8-Problem   Reply  
Picture of Jörg Spieler
Jörg Spieler
2005-01-07 11:53:28 - In reply to message 3 from Jörg Spieler
So now we no: I've used the wrong map-file.

Thank you, for your fast support!

  5. Re: ISO-8859-2 to UTF8-Problem   Reply  
Picture of Jörg Spieler
Jörg Spieler
2005-01-08 10:20:11 - In reply to message 4 from Jörg Spieler
by the way: I know the difference between "no" and "know"!! :D