douluoxiao2286 2018-12-05 22:29
浏览 116

在MySQL中将latin1转换为utf8md4的问题

I have a MySQL database on a shared hosting server and by default it is set to latin1 encoding, but have string values which have foreign characters.

When I query the database in the command line, the values show correctly, ie "Domain Cuvée". However, when I am accessing via php/webpage, the value shows as "Domaine Cuv\u00e9e".

My character set/collation results are below.

SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%';


+--------------------------+-------------------+
| Variable_name            | Value             |
+--------------------------+-------------------+
| character_set_client     | latin1            |
| character_set_connection | latin1            |
| character_set_database   | utf8              |
| character_set_filesystem | binary            |
| character_set_results    | latin1            |
| character_set_server     | utf8              |
| character_set_system     | utf8              |
| collation_connection     | latin1_swedish_ci |
| collation_database       | utf8_unicode_ci   |
| collation_server         | utf8_unicode_ci   |

I am unable to access the my.cnf file, so setting the character_set values there is not an option. Is there any way I can show the correct characters via query or changing settings? I've tried changing in phpmyadmin and no avail.

TO clarify, the link below does not answer my question as I am not using php to connect to my database. I am using core data for most of my data connections and I can't modify the charset from the client side.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
    • ¥15 lammps拉伸应力应变曲线分析
    • ¥15 C++ 头文件/宏冲突问题解决
    • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
    • ¥50 安卓adb backup备份子用户应用数据失败
    • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
    • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
    • ¥30 python代码,帮调试,帮帮忙吧
    • ¥15 #MATLAB仿真#车辆换道路径规划
    • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建