Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin1!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.011 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'subject:error': 0.11; 'encoding': 0.15; '"import': 0.16; '11:32': 0.16; 'benjamin': 0.16; 'correctly,': 0.16; 'subject:unicode': 0.16; 'wrongly': 0.16; '\xc3\xa9crit\xc2\xa0:': 0.16; 'wrote:': 0.17; 'thu,': 0.17; '>>>': 0.18; 'windows': 0.19; "skip:' 40": 0.22; 'cc:2**0': 0.23; 'seems': 0.23; 'least': 0.25; 'cc:addr:python.org': 0.25; 'header :In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; '--------': 0.28; 'code': 0.31; "skip:' 20": 0.32; 'received:google.com': 0.34; 'nov': 0.35; 'subject:?': 0.35; 'received:209.85': 0.35; 'characters': 0.36; 'option': 0.37; 'received:209': 0.37; 'received:209.85.216': 0.37; 'subject:: ': 0.38; 'skip:o 20': 0.38; 'nothing': 0.38; 'gives': 0.39; 'your': 0.60; 'from:no real name:2**0': 0.60; 'console,': 0.84; 'novembre': 0.84; 'oscar': 0.84 Newsgroups: comp.lang.python Date: Thu, 8 Nov 2012 11:54:23 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=83.79.110.133; posting-account=ung4FAoAAAC46zhHJ0Nsnuox7M5gDvs_ References: <09a3d20b-5871-47f4-9218-df119698e405@m4g2000yqf.googlegroups.com> <509AF3EF.8050108@gmail.com> <65910cea-f145-409c-a579-9f0cda499546@googlegroups.com> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 83.79.110.133 MIME-Version: 1.0 Subject: Re: Right solution to unicode error? From: wxjmfauth@gmail.com To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: Python X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 63 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1352404465 news.xs4all.nl 6891 [2001:888:2000:d::a6]:59714 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:32977 Le jeudi 8 novembre 2012 19:49:24 UTC+1, Ian a =C3=A9crit=C2=A0: > On Thu, Nov 8, 2012 at 11:32 AM, Oscar Benjamin >=20 > wrote: >=20 > > If I want the other characters to work I need to change the code page: >=20 > > >=20 > > O:\>chcp 65001 >=20 > > Active code page: 65001 >=20 > > >=20 > > O:\>Q:\tools\Python33\python -c "import sys; >=20 > > sys.stdout.buffer.write('\u03b1\n'.encode('utf-8'))" >=20 > > =CE=B1 >=20 > > >=20 > > O:\>Q:\tools\Python33\python -c "import sys; >=20 > > sys.stdout.buffer.write('\u03b1\n'.encode(sys.stdout.en >=20 > > coding))" >=20 > > =CE=B1 >=20 >=20 >=20 > I find that I also need to change the font. With the default font, >=20 > printing '\u2013' gives me: >=20 >=20 >=20 > =C3=A2=E2=82=AC=E2=80=9C >=20 >=20 >=20 > The only alternative font option I have in Windows XP is Lucida >=20 > Console, which at least works correctly, although it seems to be >=20 > lacking a lot of glyphs. -------- Font has nothing to do here. You are "simply" wrongly encoding your "unicode". >>> '\u2013' '=E2=80=93' >>> '\u2013'.encode('utf-8') b'\xe2\x80\x93' >>> '\u2013'.encode('utf-8').decode('cp1252') '=C3=A2=E2=82=AC=E2=80=9C' jmf