1

我从本教程转换我的数据库

http://en.gentoo-wiki.com/wiki/Convert_latin1_to_UTF-8_in_MySQL

但我没有注意到数据库内的阿拉伯字符加密的比如

اوÙاµ ®ØµØ… „Ù‡ Øكلق§Ø‡Ø°Ù…ا؄مشٳÙÙ‹ ÙÙ„...

通过 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

它工作正常,我也可以看到数据库中的阿拉伯字符,但是缺少很多字符,例如:

想去购物

转换后

我想

我想知道如何修复阿拉伯字符,使其在数据库中正常读取,不遗漏任何内容

谢谢

4

1 回答 1

0

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.

于 2011-08-08T08:57:47.073 回答