Problem:
When I retrieve values from MySQL table to my PHP Zend Framework-application, the characters ä and ö are returned from the database to my browser like this �.
Any ideas where the problem might occur? I have tried setting some properties to UTF-8, but still this occurs…I think I have still missed something.
Could you give some solutions how I can get rid of this for sure? What configs I need to set etc.
Thank you 🙂
When characters of the wrong encoding are read to the browser, they come up as � or ?. There is an encoding mismatch somewhere:
Those characters would work in Unicode UTF-8, so you should verify that your DB table collation is
utf8_binor similar, as, if you want to store everything in UTF-8 Swedish, you might useutf8_swedish_ciIn your browser, ensure that your content encoding is set to auto-detect.
To create a UTF-8 / utf8_bin table in MySQL, here is an example:
To ALTER an existing table to use UTF-8, use the following command:
This post has a good explanation of whether or not to use
CONVERT TO CHRACTER SET utf8Note
CHARSETandCOLLATEmust both be set, otherwise you will automatically getCOLLATE=utf8_general_ciFor HTML, charset can be set using: