views:

432

answers:

2

Hi, i need to import XML to mysql database. It is imported in ISO-8859-1 encoding. Well, it is very old mysql version 4.0.27 + php 4. The problem is - when I take texts from database to website I need to change encoding to windows-1250. I have no idea why, but iconv or mb_convert_encoding doesnt work (it does something, but it still looks not ok). I managed to change encoding of XML to utf-8 .. but the problem preserves. I can't get it convert from utf-8 to windows-1250. ??? many thanks

A: 

Iconv() is quite certainly the way to go and if it doesn't work, then my guess would be there is something wrong with the input (or it is in a different format that happens to be rendered correctly in your environment). Could that be?

Edit: Maybe that helps? http://de.php.net/manual/en/function.iconv.php#59030

Pekka
+2  A: 

Windows-1250 doesn't closely map to iso-8859-1. It more closely maps to iso-8859-2. If you are using characters in the source encoding that aren't available in the destination encoding, you'll either get a default character or a best-fit character, depending on options you specify with your transcoding tool.

Can you clarify the steps involved and the content of your data? It would help to figure out what your options are.

JasonTrue
Right, if the text has a lot of upper 128 characters, even the "correct" conversion to Windows-1250 is going to be very lossy. Keep and publish your data in UTF-8 if at all possible.
mrclay