Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Tim Golden Newsgroups: comp.lang.python Subject: Re: Pyhon 2.x or 3.x, which is faster? Date: Wed, 9 Mar 2016 15:15:07 +0000 Lines: 31 Message-ID: References: <87d1r6iltx.fsf@elektro.pacujo.net> <56de28a1$0$1604$c3e8da3$5496439d@news.astraweb.com> <56de57b5$0$1590$c3e8da3$5496439d@news.astraweb.com> <56df6873$0$1588$c3e8da3$5496439d@news.astraweb.com> <56df87f7$0$1620$c3e8da3$5496439d@news.astraweb.com> <56e0393e$0$22140$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de irPwWGJw/2nWE6Xnrt3TKA4QwhyOCaSyDgZS458rcvBA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'error:': 0.05; 'initialize': 0.05; 'sys': 0.05; 'url:pipermail': 0.05; 'encoding:': 0.07; 'utf-8': 0.07; '172': 0.09; 'subject:which': 0.09; 'python': 0.10; 'result.': 0.15; '3.3,': 0.16; 'binary,': 0.16; 'decode': 0.16; 'fatal': 0.16; 'from:addr:timgolden.me.uk': 0.16; 'from:name:tim golden': 0.16; 'idea!': 0.16; 'message- id:@timgolden.me.uk': 0.16; 'received:74.55.86': 0.16; 'received:74.55.86.74': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'received:smtp.webfaction.com': 0.16; 'received:webfaction.com': 0.16; 'tjg': 0.16; 'wrote:': 0.16; '>>>': 0.20; 'this:': 0.23; 'header:In-Reply-To:1': 0.24; '----------': 0.25; 'header:User-Agent:1': 0.26; 'earlier': 0.27; 'error': 0.27; 'used,': 0.27; '(including': 0.30; 'code': 0.30; "can't": 0.32; 'getting': 0.33; 'run': 0.33; 'url:python': 0.33; "d'aprano": 0.33; 'steven': 0.33; 'changing': 0.34; 'file': 0.34; 'gives': 0.35; 'could': 0.35; 'skip:b 50': 0.35; 'unknown': 0.35; 'should': 0.36; 'instead': 0.36; 'url:org': 0.36; 'to:addr:python- list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'version': 0.38; 'received:192': 0.39; 'url:mail': 0.40; 'to:addr:python.org': 0.40; 'charset:windows-1252': 0.62; 'from:addr:mail': 0.70; '*no': 0.84; 'streams': 0.84 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:104420 On 09/03/2016 15:06, Jon Ribbens wrote: > On 2016-03-09, Steven D'Aprano wrote: >> generate the output. Without seeing the code you used, I have *no idea* how >> you could get that result. If you read the file in binary, you should get >> this: >> >> b'\xef\xbb\xbf\xe2\x82\xac\xe2\x82\xac\xe2\x82\xac' >> >> Or in decimal: >> >> 239, 187, 191, 226, 130, 172, 226, 130, 172, 226, 130, 172 >> >> How you are getting 8218 instead of 130, I have no idea! > > Decode as "windows-1252". > >>> Changing it to UTF-8 however (CHCP 65001 in Windows) gives me this >>> error when I run the program again: >>> >>> ---------- >>> Fatal Python error: Py_Initialize: can't initialize sys standard streams >>> LookupError: unknown encoding: cp65001 > > cp65001 was added in Python 3.3, any earlier version (including any > Python 2) will not understand it. It's also somewhat flaky in other ways https://mail.python.org/pipermail/python-list/2015-December/700351.html TJG