数据库内UTF-8编码加密
我根据本教程转换我的数据库
http://en.gentoo-wiki.com/wiki/ Convert_latin1_to_UTF-8_in_MySQL
但我没有注意到阿拉伯字符INSIDE数据库是加密,就像
اوÙاµ ®ØµØ… „Ù‡ Øكلق§Ø‡Ø°Ù…ا؄مشٳÙÙ‹ ÙÙ„...
通过php脚本连接数据库一切都很好 ,但在数据库内部,阿拉伯字符看起来像
我尝试通过以下命令使用 iconv 将数据库返回到旧编码,即 WINDOWS-1256
# iconv -f UTF-8 -t WINDOWS-1252 database.sql > database_1252.sql
我收到此错误
iconv: 位置上的非法输入序列,
所以我尝试使用 -c 选项再次运行命令
# iconv -c -f UTF-8 -t WINDOWS-1252 database.sql > database_1252.sql
,它起作用了,我也可以看到数据库中的阿拉伯字符,但缺少很多字符,例如:
我想去购物< /strong>
转换后,
我想知道
如何修复阿拉伯字符,使其在数据库内正常读取,不丢失任何内容,
谢谢
i Convert my database from this tutorial
http://en.gentoo-wiki.com/wiki/Convert_latin1_to_UTF-8_in_MySQL
but i didn't notice the arabic characters INSIDE the database is encrypted , like
اوÙاµ ®ØµØ… „Ù‡ Øكلق§Ø‡Ø°Ù…ا؄مشٳÙÙ‹ ÙÙ„...
through the php script connect with the database everything GOOD , but inside the database the arabic characters looks like that
i try to return the database to the old encoding which is WINDOWS-1256 using iconv by the following command
# iconv -f UTF-8 -t WINDOWS-1252 database.sql > database_1252.sql
i got this error
iconv: illegal input sequence at position
so i try to run the command again using -c option
# iconv -c -f UTF-8 -t WINDOWS-1252 database.sql > database_1252.sql
it's worked and i can see the arabic characters inside the database as well, but alot of characters missing , for example :
i would like to go shopping
after the converting
i would like to
i want to know how could i fix the Arabic Characters to be read as normal inside the database complete not missing anything
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
等等......你说你的数据库是WINDOWS-1256(或WINDOWS-1252?)并且你根据教程latin1转换了它 - > utf8?难怪人物都是畸形的。
我根本不相信教程解决方案。我建议您返回到以前版本的数据库并使用 mysql
alter table
命令更改编码。Wait wait .... you say your database was in WINDOWS-1256 (or WINDOWS-1252?) and you converted it based on tutorial latin1 -> utf8? No wonder the characters are malformed.
I wouldn't trust to the tutorial solution at all. I would recommend that you return to your former version of the database and use mysql
alter table
command to change the encoding.