How to display chinese character in 65001 in pytohn?

length power elearn2014 at gmail.com
Wed Apr 9 21:54:37 EDT 2014


I am in win7 +python3.3.

    import os
    os.system("chcp  936")
    fh=open("test.ch","w",encoding="utf-8")
    fh.write("你")
    fh.close()
    os.system("chcp 65001")
    fh=open("test.ch","r",encoding="utf-8").read()
    print(fh)
    Äã
    >>> print(fh.encode("utf-8"))
    b'\xe4\xbd\xa0'

How can i display the chinese character  `你` in 65001?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140410/dcdb6f8a/attachment.html>


More information about the Python-list mailing list