Tuesday, 24 August 2010

如何将汉字转换成Unicode?

使用JDK自带的命令行程序native2ascii进行转换。
例如,
1.将需要转换的词汇放在input.txt文件内;
2.运行native2ascii -encoding utf-8 input.txt output.txt
3.文件output.txt中即包含转换后的UTF-8编码
如果需要做逆转换,可运行native2ascii -encoding utf-8 -reverse output.txt input.txt
注意:文本文件的编码建议采用“UTF-8 without BOM”

No comments:

Post a Comment

Note: only a member of this blog may post a comment.