Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #69997 > unrolled thread

How to display chinese character in 65001 in pytohn?

Started bylength power <elearn2014@gmail.com>
First post2014-04-10 09:54 +0800
Last post2014-04-10 09:54 +0800
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  How to display chinese character in 65001 in pytohn? length power <elearn2014@gmail.com> - 2014-04-10 09:54 +0800

#69997 — How to display chinese character in 65001 in pytohn?

Fromlength power <elearn2014@gmail.com>
Date2014-04-10 09:54 +0800
SubjectHow to display chinese character in 65001 in pytohn?
Message-ID<mailman.9104.1397094885.18130.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

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?

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web