简体   繁体   English

Ubuntu mysql数据库无法识别西班牙语重音字符

[英]Ubuntu mysql database doesnot recognise spanish accent characters

I have a problem with storing spanish text in mysql database in Ubuntu. 我在Ubuntu的mysql数据库中存储西班牙语文本时遇到问题。 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. 我知道这不是mysql数据库问题。 Since both development and production databases are exactly same and are utf8-mb4 enabled. 由于开发和生产数据库完全相同,并且启用了utf8-mb4。

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 开发环境-Windows,PHP 6.0和Mysql 5.6.14生产环境-Ubuntu,PHP 5.3.2和Mysql 5.6.14-62.0

All the php files in dev and production are UTF-8 without BOM encoded 开发和生产中的所有php文件均为UTF-8,无BOM编码

Any recommendations of how to fix this issue? 关于如何解决此问题的任何建议? Would upgrading php version help? 升级php版本会有所帮助吗?

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? 浏览器说它将结果解释为什么?

The most likely culprit in this case is that the php<->mysql connection isn't set to be utf8 . 在这种情况下,最可能的罪魁祸首是php <-> mysql连接未设置为utf8 See the connection "Configuring the MySQL Connection" in http://webmonkeyuk.wordpress.com/2011/04/23/how-to-avoid-character-encoding-problems-in-php/ 请参阅http://webmonkeyuk.wordpress.com/2011/04/23/how-to-avoid-character-encoding-problems-in-php/中的 “配置MySQL连接”连接

The exact syntax will depend on how you connect to Mysql. 确切的语法将取决于您如何连接到Mysql。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM