数据库字符集转换
我已将数据库从一台主机移动到另一台主机。我使用 PMA 导出,使用 bigdump 导入。整个数据库在任何可能的地方都设置了 latin2 字符集。然而在数据库中,特殊字符(波兰语ąęłó等)被破坏。当我使用 SELECT 时,我看到“灌木丛”-“ą”插入“ą”。然后我将文档编码设置为utf-8...并且字符很好。如何解决这个问题?可以在查询中使用 CONVERT 来完成吗?我不想再次导出/导入数据库,因为它已经超过 200MB。怎么了?
每个 PHP/MySQL 查询解决方案都会拯救我。
抱歉,如果您听不懂,因为我仍在学习英语。
I've moved database from one host to another. I've used PMA to export and bigdump to import. The whole database have latin2 charset set everywhere where it's possible. However in database, special chars (polish ąęłó, etc.) are broken. When I used SELECT i see "bushes" - "Ä�" insetad of "ą". Then I've set document encoding to utf-8... And the characters are good. How to fix this? Can it be done using CONVERT in query? I don't want to export/import database again, because it has over 200MB. What's wrong?
Every PHP/MySQL query solution will save me.
Sorry if you can't understand this, because I'm still learning english though.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果表包含错误类型的字符集(假设 utf-8 已滑入 latin1 列 varhcar(255)):
另请参阅:http://dev.mysql.com/doc/refman/4.1/en/charset-conversion.html
但是,更有可能是您的默认连接中的字符集错误。选择之前
SET NAMES latin1;
会产生什么结果?If a table contains the wrong kind of charset (let's say utf-8 has slipped into latin1 column varhcar(255)):
See also: http://dev.mysql.com/doc/refman/4.1/en/charset-conversion.html
However, it is more likely you just have a wrong character set in your default connection. What does a
SET NAMES latin1;
before selecting result in?