2014年6月30日 星期一
Convert Hex to Unicode String by Java SDK or python
If there is a file include charsequence such like:
\u53f0\u7063
and how to convert it to Unicode?
There are two ways to achieve this requirement: Python and Java SDK
1.Java SDK:
ref this link: http://blog.xuite.net/jameschih/java/5089783
use the java sdk tool in the bin folder
native2ascii -reverse src.txt dist.txt
then "\u53f0\u7063" convert to "台灣"
on the other hand you can convert unicode string to hex
native2ascii src.txt dist.txt
========================================================================
2.Python
ref:
http://stackoverflow.com/questions/447107/what-is-the-difference-between-encode-decode
print u'\\u53f0\\u7063'.decode('unicode-escape')
then output 台灣
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言