phpMyAdmin 中的编码问题。特别是包含俄语文本的记录
我正在为我未来的 CMS/框架制作小模块/插件。我从一开始就希望它具有多语言支持。
- 我将我的新数据库设置为
utf8_unicode_ci
(我读到它更准确,然后utf8_general_ci
) - 将我的文件设置为 UTF-8 without BOM
- 每个页面都有头部
内容类型:text/html; charset=utf8
当我注册新用户时,新记录将添加到用户表中。我尝试使用俄罗斯昵称注册用户。当我将它插入成型时,一切都很好。将记录添加到表中。登录并用俄语打招呼也很好。但当我查看表中的记录时,昵称是一些乱码。我在浏览器中尝试了所有编码。没有任何帮助。
UPD:我什至尝试使用 SQLyog 查看数据。显示与 phpMyAdmin 相同。
我的意思的小屏幕截图 alt text http://s43.radikal.ru/ i101/1006/a9/f458f64a9918.png
谁能给我解释一下,可能是什么问题?
I'm making small module/plugin for my future CMS/Framework. I wanted it from begining to be with multi-language support.
- I set my new database to
utf8_unicode_ci
(I read that it is more accurate, thenutf8_general_ci
) - Set my files to UTF-8 without BOM
- Every page has in head
Content-Type: text/html; charset=utf8
When I register new user new record is added to user table. I tried to register user with russian nickname. When I inserted it to form it was fine. Added record to table. Signed in and showed greetings fine in russian too. But when I looked at the record in table the nickname was some gibberish characters. I tried all encodings in browser. Nothing helped.
UPD: I even tried to view data with SQLyog. Shows same as phpMyAdmin.
Small screenshot of what I mean alt text http://s43.radikal.ru/i101/1006/a9/f458f64a9918.png
Could anyone explain to me, what might be the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是我之前关于同一问题的回答,请尝试: 如何在php中正确显示另一种语言的mysql表数据
Here's an earlier answer of mine about the same problem, try that: How to display a mysql table data in another language properly in php
是元标记还是 HTTP 标头?一定是后一种。
每次在 PHP 脚本中连接到数据库时,都必须运行 SET NAMES utf8 查询
is it meta tag or HTTP header? must be a latter one.
and you have to run
SET NAMES utf8
query every time you connect to the database in your PHP scripts