这个网站如何修正编码? [英] How is this website fixing the encoding?
问题描述
我试图翻译这段文字:
×וויר。 ×עת××××××××××××××××××××××××××××××× ×¨×ª×©×œ×ו
进入此文本:
אוויר。不知为什么,这个网站:
$ b
$ b < $ b http://www.pixiesoft.com/flip/
可以做到这一点,我想知道我自己可以做什么(用任何编程语言或软件)
只是将文件保存为UTF8不会这样做。
我的这个问题的动机是,我有一个朋友的导出XML文件与乱码文本希望变成更正的希伯来文本文件。
XML导出最初是由MySQL导入和导出乱码,但我没有修复它或traceback所需的信息问题。
感谢。
解决方案 MySQL故障带有双重编码的UTF8字符串,MySQL是正确的解决方法。
运行以下命令将解决它 -
-
mysqldump $ DB_NAME -u $ DB_USER -p -h $ DB_HOST.EXAMPLE.NET --add-drop-table --default-character-set = latin1> export.sql
- latin1用于强制MySQL不分割字符,不应该使用。
-
cp export {,。utf8} .sql
- 制作备份副本。
-
sed -i -e's / latin1 / utf8 / g'export.utf8.sql
- 用文件中的utf8替换latin1,以便将其导入为UTF- 8而不是8859-1。
-
mysql $ DB_NAME -u $ DB_USER -p -h $ DB_HOST.EXAMPLE.NET< export.utf8.sql
- 将所有数据导入数据库。
10分钟。
I am trying to turn this text:
×וויר. ×"עתי×" של רשתות חברתיות ו×"תקשורת ×©×œ× ×•
Into this text:
אוויר. העתיד של רשתות חברתיות והתקשורת שלנו
Somehow, this website:
http://www.pixiesoft.com/flip/
Can do it, and I would like to know how I might be able to do it myself (with whatever programming language or software)
Just saving the file as UTF8 won't do it.
My motivation for this question is that I have a friend's exported XML file with the garbled text which I want to turn into corrected Hebrew text file.
The XML export was originally garbled by MySQL import and exports, but I don't have the information needed to fix it or traceback the problem.
Thanks.
解决方案 Since the issue was a MySQL fault with double-encoded UTF8 strings, MySQL is the right way to solve it.
Running the following commands will solve it -
mysqldump $DB_NAME -u $DB_USER -p -h $DB_HOST.EXAMPLE.NET --add-drop-table --default-character-set=latin1 > export.sql
- latin1 is used here to force MySQL not to split the characters, and should not be used otherwise.
cp export{,.utf8}.sql
- making a backup copy.
sed -i -e 's/latin1/utf8/g' export.utf8.sql
- Replacing the latin1 with utf8 in the file, in order to import it as UTF-8 instead of 8859-1.
mysql $DB_NAME -u $DB_USER -p -h $DB_HOST.EXAMPLE.NET < export.utf8.sql
- import everything back to the database.
This will solve the issue in about ten minutes.
这篇关于这个网站如何修正编码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!