简体   繁体   English

特殊字符在浏览器中正确显示,但在phpMyAdmin中却被加扰

[英]Special characters display correctly in browser but are scrambled in phpMyAdmin

I have a php netbeans project. 我有一个php netbeans项目。 The encoding for the project is UTF-8. 该项目的编码为UTF-8。 Special characters display correctly in the ide. 特殊字符在ide中正确显示。 (img 1) (img 1)

I use phpmyadmin and the encoding for the entire database is utf8_unicode_ci (the column also shows this). 我使用phpmyadmin,整个数据库的编码为utf8_unicode_ci(该列也显示了这一点)。 (img 2) (img 2)

I use mysqli to connect, and it doesn't make any diference if I call 我使用mysqli进行连接,如果我打电话,它不会产生任何区别

set_caharset("utf8"); 

(img 3) (img 3)

In the browser everything is ok (including searches with special characters): (img 4) 在浏览器中,一切正常(包括使用特殊字符进行的搜索):(img 4)
But in phpMyAdmin the text introduced through mysqli is scrambled (whilst text introduced manually is ok - id 13 in the picture) (img 5) 但是在phpMyAdmin中,通过mysqli引入的文本被打乱了(手动引入的文本也可以-图片中的ID 13)(img 5)

编码问题phpmyadmin mysqli

What should I do to send text correctly in phpmyadmin. 我应该怎么做才能在phpmyadmin中正确发送文本。

[edit] Some more info. [编辑]更多信息。 I don't know how to interpret or use this, bu this is what 我不知道该如何解释或使用它

SHOW VARIABLES LIKE 'character_set%'

displays. 显示。

Variable_name: Value
character_set_client: utf8mb4
character_set_connection: utf8mb4
character_set_database: latin1
character_set_filesystem: binary
character_set_results: utf8mb4
character_set_server: latin1
character_set_system: utf8
character_sets_dir: D:\Programe\XAMPP\mysql\share\charsets\

[edit2] Ok, it is something that is server related. [edit2]好的,这与服务器相关。 I uploaded the same code that generated the database on a different server and everything is ok. 我上传了在另一台服务器上生成数据库的相同代码,一切正常。 Do you have any ideas where the problem could be? 您对可能出现问题的地方有任何想法吗?

It's resolved! 解决了!

I'm not sure how, because I made multiple modifications before testing. 我不确定如何进行测试,因为我在测试之前进行了多次修改。 Where I edited: 我编辑的地方:

  • on the front-page of phpmyadmin (localhost/phpmyadmin) under server colation I choose other types of utf8. 在服务器排序规则下的phpmyadmin(localhost / phpmyadmin)的首页上,我选择了其他类型的utf8。

  • I had a different connection class for the setup where I didn't call: set_caharset("utf8"); 对于没有调用的设置,我有一个不同的连接类:set_caharset(“ utf8”);

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

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