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


Groups > comp.lang.python > #69997

How to display chinese character in 65001 in pytohn?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <elearn2014@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.037
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'skip:f 70': 0.09; 'subject:How': 0.10; 'skip:f 60': 0.16; 'url:ch': 0.16; 'win7': 0.16; 'skip:f 30': 0.19; '>>>': 0.22; 'import': 0.22; '&gt;&gt;&gt;': 0.24; 'skip:p 30': 0.29; 'character': 0.29; 'message-id:@mail.gmail.com': 0.30; 'display': 0.35; 'received:google.com': 0.35; '8bit%:9': 0.36; 'skip:f 40': 0.36; 'subject:?': 0.36; 'skip:o 20': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'how': 0.40; 'chinese': 0.74
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=mIaP9624kQSemqPODWqAqxOQl0aNnx4R0PP0rEzVWKI=; b=jomOTORLc2S+2dEtcjwj+fQsObWcBWZ4yR5jlFdBiHO3CGDi7L62fhy40z4O4nrs7x YSHuNdJtvR/pWwiWIGZJkrTuxOQSt9Q/+QKDipTjM7yEsg3unq6r8ISbYlcVN13FFvtW SH+kndRWgNGUWycf6rk2rcqKglxflSvC7VQQCG/p9D+W2qUmNkw9tgKDFtrT/XPWSt8/ ytN4qVrzjRHIbeLVCqKqNOoyY3FG9fh/T29z6ohXrHpRMZ4+y44cVZsx641Q5Hw+U+Y/ Rd5Rhh3EWhK/+HwOIPzb7+Djl9L4F5vuVSUz0JbtCzJ6aPjpSsYHWxjr6asRZc8XOi2p Dh7A==
MIME-Version 1.0
X-Received by 10.112.22.130 with SMTP id d2mr9323882lbf.33.1397094877682; Wed, 09 Apr 2014 18:54:37 -0700 (PDT)
Date Thu, 10 Apr 2014 09:54:37 +0800
Subject How to display chinese character in 65001 in pytohn?
From length power <elearn2014@gmail.com>
To python-list@python.org
Content-Type multipart/alternative; boundary=14dae94732b9e6e1f304f6a67f52
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.9104.1397094885.18130.python-list@python.org> (permalink)
Lines 38
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1397094885 news.xs4all.nl 2898 [2001:888:2000:d::a6]:36750
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:69997

Show key headers only | View raw


[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?

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web