Question

I have a problem with storing spanish text in mysql database in Ubuntu. The spanish accent characters like ñ are displayed incorrectly as "ñ" This happens in production not in development environment.

I know that this is not a mysql database issue. Since both development and production databases are exactly same and are utf8-mb4 enabled.

Development environment - Windows, PHP 6.0 and Mysql 5.6.14 Production environment - Ubuntu, PHP 5.3.2 and Mysql 5.6.14-62.0

All the php files in dev and production are UTF-8 without BOM encoded

Any recommendations of how to fix this issue? Would upgrading php version help?

Was it helpful?

Solution

You're getting two bytes back it looks like, which is good. If this is being displayed on a web page, are the headers being set correctly? What does the browser say it's interpreting the results as?

OTHER TIPS

The most likely culprit in this case is that the php<->mysql connection isn't set to be utf8. See the connection "Configuring the MySQL Connection" in http://webmonkeyuk.wordpress.com/2011/04/23/how-to-avoid-character-encoding-problems-in-php/

The exact syntax will depend on how you connect to Mysql.

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