Re: Read utf-8 file

2013-03-18 Thread Peter Otten
moonhkt wrote: > How to display > e4b8ad for 中 in python ? Python 2 >>> print u"中".encode("utf-8").encode("hex") e4b8ad Python 3 >>> print(binascii.b2a_hex("中".encode("utf-8")).decode("ascii")) e4b8ad -- http://mail.python.org/mailman/listinfo/python-list

Read utf-8 file

2013-03-18 Thread moonhkt
File have China Made 中國 製 http://www.fileformat.info/info/unicode/char/4e2d/index.htm UTF-16 (hex)0x4E2D (4e2d) UTF-8 (hex) 0xE4 0xB8 0xAD (e4b8ad) Read by od -cx utf_a.text 000 中 ** ** 國 ** ** 製 ** ** \n e4b8ade59c8be8a3bd0a 012 Read by py