xml php mysql utf-8:希腊字符在 xml 中显示不正确
我正在加载外部 xml 文件。
我正在获取一些节点值,以 html 形式输出它们作为选择表单,并将这些值以及用户输入的文本保存到 mysql 中。
插入mysql的字符是希腊语。
我在我的html头中使用utf8元,在php中的sql连接之后使用“SET NAMES utf-8”,在我的notpad ++编辑器中使用utf-8编码,还在我的表中使用utf-8_general_ci。请注意,当创建dtbs时,排序规则是拉丁语,我手动将其更改为 utf8。一切都正确传递到 mysql。
到目前为止,我有一个根据我的选择生成 xml 的函数。xml 的节点名称和值等于 mysql 查询。非常适合英语字符,但当涉及到希腊语时,我只得到问号(“?”)打印。另外,我已经将 utf8 选项包含到新的 domdocument 调用中。
知道我应该怎么做才能在我的 xml 上获取希腊字符吗? 提前致谢。
I m loading an external xml file .
I m getting some node values,output em in html as a select form and save these plus a text input by the user into mysql.
The characters inserted to mysql are greek.
I use the utf8 meta in my html head, the "SET NAMES utf-8" after my sql connection in php,utf-8 encoding in my notpad++ editor and also utf-8_general_ci in my table.Note here that when dtbs was created collation was latin and i manually changed it to utf8.Everything is passed correctly to mysql.
Till now i had a function that was generating an xml according to my selection.The xml's node names and values where equal to the mysql query.Works perfect for english chars but when it comes to greek i get only question marks("?") printed. Also, i have already included the utf8 option to the new domdocument call.
Any idea on what should i do to get the greek characters on my xml?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方案:
mysql_set_charset 完成了这项工作。
我错过了这里定义的排序规则和字符集女巫之间的区别:
一般字符集和排序规则
Solution:
mysql_set_charset did the work.
I missed the difference between collation and charset witch is defined here:
Character Sets and Collations in General