views:

115

answers:

2

I have just imported a huge MySQL database. Most fields are latin1_swedish_ci, and they contain lots of corrupted strings.

e.g. Cavit Y�r�kl� instead of Cavit Yürüklü

I have been trying to find a solution to fix these corruptions using PHP as thats all I know a little bit of. I have played unsuccessfully with utf8_(en|de)code, iconv.

Please help!!! As it is loads of corruptions.

UPDATE: Reimported as Latin 1 and now have for above, Cavit Y�r�kl�. So its definately different but the sql itself seems to be corrupted.

+2  A: 

Yeah it's using the wrong encoding. Check out http://www.oreillynet.com/onlamp/blog/2006/01/turning_mysql_data_in_latin1_t.html to know how to fix it. You just need to find out what encoding it is in now and what you want it to be in and then you can convert. Or setup the db to match the encoding of the data you are importing (if thats an option)

olle
This is great to know but in my case, all the characters had somehow corrupted to the same value, so it was obvious that the data was beyond repair.
esryl
A: 

First I would make a copy of the db dump, then I would try using iconv - and I know you said you tried but there are many, many combinations of character encodings that you can try out - I once had to fix some corrupted Russian Cyrillic data - what ended up working was specifying an output value of 'UTF-8//TRANSLIT' - I would try all the combinations that you can but remember to keep a copy of the original.

meder