質問

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.

役に立ちましたか?

解決

OK - the answer is utf8_decode() in PHP.

他のヒント

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top