db1
db1

Reputation: 3179

Ubuntu mysql database doesnot recognise spanish accent characters

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?

Upvotes: 0

Views: 259

Answers (2)

chooban
chooban

Reputation: 9256

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?

Upvotes: 1

Daniel Martin
Daniel Martin

Reputation: 23558

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.

Upvotes: 0

Related Questions