Hbase encoding displays Chinese and Chinese to hexadecimal

from

http://blog.csdn.net/maixia24/article/details/21094313




Hbase table according to ascii data query corresponding Chinese method



On the 172.168.8.90 server, enter Python, enter the Python command:

Python

and then enter the following command:

print '\xE4\xB9\xB1\xE4\xB8\x96'.decode('utf-8')

print result: troubled times

where \xE4\xB9\xB1\xE4\xB8\x96 is the converted data,

decode(' utf-8') Specify to print out in 'utf-8' encoding



Exit python command: ctrl+z



know the Chinese result, query its hexadecimal representation:

1, first ensure that the encoding is utf-8 without bom encoding format ( You can use the editplus tool, fileencoding)

2 under docmnet, then use the ultraedit editing tool to open the document, and select hexadecimal editing under edit to view the Chinese hexadecimal data. Note that you need to add \x before every two characters. For



example: the test hexadecimal view result is E6 B5 8B AF 95

plus \x ie \xE6\xB5\x8B\xAF\x95



and then the print in python should be Chinese "test" "

print '\xE6\xB5\x8B\xAF\x95'.decode('utf-8')

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326460458&siteId=291194637