Question

Hi I have inherited a db which I need to use the data from. Unfortunately some of the text is spanish and has some obvious encoding issues. For example this is a typical string stored in a text field:

Clara introducción a través del transporte de me...

My question is - is there any easy way to transform these characters back to what they were using MySQL/PHP?

Any suggestions appreciated.

Was it helpful?

Solution

OK - the answer is utf8_decode() in PHP.

OTHER TIPS

After you connect to your database be sure to set the character set you want to communicate in.

This will depend on the library or PDO you're using but something along the lines of mysql_set_charset('utf-8');

Further, when you are printing the output ensure your console is set to UTF8. If you are displaying in a webpage, ensure that pages charset is set correctly via headers and/or meta tags.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top