Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python': 0.09; '(it': 0.09; 'encode': 0.09; 'cc:addr:python-list': 0.10; 'subject:error': 0.11; '(like': 0.15; 'charset:iso-8859-7': 0.15; 'benjamin': 0.16; 'codec': 0.16; 'subject:unicode': 0.16; 'unicode.': 0.16; 'wrote:': 0.17; 'unicode': 0.17; '>>>': 0.18; 'windows': 0.19; 'versions': 0.20; 'skip:" 40': 0.20; '"",': 0.22; '(on': 0.22; 'claimed': 0.22; 'cc:2**0': 0.23; "i've": 0.23; 'command': 0.24; 'tried': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; '(most': 0.27; 'andrew': 0.27; 'message-id:@mail.gmail.com': 0.27; "doesn't": 0.28; '(possibly': 0.29; 'character': 0.29; 'worked': 0.30; 'received:209.85.215.46': 0.30; 'checked': 0.30; 'code': 0.31; 'point': 0.31; 'file': 0.32; 'traceback': 0.33; 'version': 0.34; "can't": 0.34; 'received:google.com': 0.34; 'so,': 0.35; 'subject:?': 0.35; 'received:209.85': 0.35; 'but': 0.36; "didn't": 0.36; 'skip:p 20': 0.36; 'does': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'fact': 0.38; 'skip:o 20': 0.38; 'page': 0.38; 'header:Received:5': 0.40; 'help': 0.40; 'think': 0.40; 'skip:u 10': 0.60; 'stand': 0.61; 'needing': 0.62; 'skip:c 50': 0.66; '(standard': 0.84; 'actually,': 0.84; 'oscar': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=2XK2Nn2wBJQOgQpTfFwM/lTAtQieG3RYM8vJdwH10fE=; b=Xj/uM3N1zCP8fz8/gVdWy8hYbyyhk+VQBKgtIRqoWIGYSxVklaUaqQQxwZGAjVadXg GLC/UWnMIXOdTItXRP3JLKyage7hw+RHpqperQlm/q42a8xXWasaABJGCZMADjJDCjBt yZF4CW/dIxLYdE4gcTCBVIO6g0e2043eZwLMpFBGQtQaTuOIlTvs6m52m+oRsNfC32VO mmIT3RohMXyYCsOXN2qskUnx7Imff7xjJQSZ+I6cJ0cYg/xS4pjGAsolvr0HpYLWi8K9 IW3HMMmaz71oPTbWJbwlWHjMLZqG+us21Wriv3tYKF3zbbyqpud2pHO+qaMIG/0LoOMP dcNw== MIME-Version: 1.0 In-Reply-To: References: <09a3d20b-5871-47f4-9218-df119698e405@m4g2000yqf.googlegroups.com> <509AF3EF.8050108@gmail.com> Date: Thu, 8 Nov 2012 14:06:42 +0000 Subject: Re: Right solution to unicode error? From: Oscar Benjamin To: Andrew Berg Content-Type: text/plain; charset=ISO-8859-7 Content-Transfer-Encoding: quoted-printable Cc: "comp.lang.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: , Newsgroups: comp.lang.python Message-ID: Lines: 43 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1352383604 news.xs4all.nl 6840 [2001:888:2000:d::a6]:46496 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:32951 On 8 November 2012 00:44, Oscar Benjamin wrote= : > On 7 November 2012 23:51, Andrew Berg wrote: >> On 2012.11.07 17:27, Oscar Benjamin wrote: >>> Are you using cmd.exe (standard Windows terminal)? If so, it does not >>> support unicode >> Actually, it does. Code page 65001 is UTF-8. I know that doesn't help >> the OP since Python versions below 3.3 don't support cp65001, but I >> think it's important to point out that the Windows command line system >> (it is not unique to cmd) does in fact support Unicode. > > I have tried to use code page 65001 and it didn't work for me even if > I did use a version of Python (possibly 3.3 alpha) that claimed to > support it. I stand corrected. I've just checked and codepage 65001 does work in cmd.exe (on this machine): O:\>Q:\tools\Python33\python -c print('abc\u2013def') Traceback (most recent call last): File "", line 1, in File "Q:\tools\Python33\lib\encodings\cp850.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_map)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\u2013' in position 3: character maps to O:\>chcp 65001 Active code page: 65001 O:\>Q:\tools\Python33\python -c print('abc\u2013def') abc-def O:\>Q:\tools\Python33\python -c print('\u03b1') =E1 It would be a lot better though if it just worked straight away without me needing to set the code page (like the terminal in every other OS I use). Oscar