简体   繁体   English

mysql排序规则适用于phpmyadmin,但不适用于sql

[英]mysql collation is fine for phpmyadmin but not for sql

i am having a database where i store both greek and english strings using collations : "greek_general_ci" and "utf8_general_ci" from phpmyadmin everything works fine ! 我有一个数据库,使用归类存储希腊语和英语字符串:来自phpmyadmin的"greek_general_ci""utf8_general_ci"一切正常! but using mysql comand from terminal, or mysql_query from php i get some "?", do you have any idea why this happends ? 但是从终端使用mysql comand,或者从php使用mysql_query我得到一些“?”,你知道为什么会发生这种情况吗? in the meanwhile everything is fine from phpmyadmin ! 同时,phpmyadmin一切正常!

i have to note that i need sometimes to use english , so a collation that supports only greek may not be much helpful, but i believe that it is not matter of the collation 我必须指出,有时我需要使用英语,因此仅支持希腊语的排序规则可能没有多大帮助,但我认为这与排序规则无关

also i have to say that i use this in my html to display greek characters : 我还必须说我在html中使用它来显示希腊字符:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

thank you 谢谢

First of all: You are barking up the wrong tree. 首先:您正在吠错树。 Your problem is not collation (or you have not yet found out so), but encoding. 您的问题不是排序规则(或尚未发现排序规则),而是编码。

  • in the tables 在表中
  • on your connection 在您的连接上

I recommend you start debugging by putting a query like SET NAMES 'UTF8' at the start of your PHP scripts. 我建议您通过在PHP脚本的开头放置一个类似SET NAMES 'UTF8'的查询来开始调试。 Quite likely, this will make the immediate problem "go away", giving you a foot in the door for a more permanent fix. 很可能,这将使眼前的问题“消失”,使您有机会永久修复。

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

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