Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Mark Lawrence Newsgroups: comp.lang.python Subject: Re: Should stdlib files contain 'narrow non breaking space' U+202F? Date: Fri, 18 Dec 2015 00:02:25 +0000 Lines: 40 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de oPPOwjrkTHk+7Gta0PGUHAG7X78a547wz1qOpe9/U19A== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'debug': 0.04; 'from:addr:yahoo.co.uk': 0.05; "subject:' ": 0.07; 'encode': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:files': 0.09; '2.7': 0.13; 'output': 0.13; 'question.': 0.13; '10:05': 0.16; 'ascii,': 0.16; 'codec': 0.16; 'cp1252': 0.16; 'losing': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'route,': 0.16; 'subject:breaking': 0.16; 'subject:non': 0.16; 'which,': 0.16; 'wrote:': 0.16; 'runs': 0.18; 'language': 0.19; '2015': 0.20; 'skip:" 30': 0.20; '3.2': 0.22; 'lawrence': 0.22; 'pipe': 0.22; 'suppose': 0.22; 'trying': 0.22; 'am,': 0.23; 'dec': 0.23; 'header:In-Reply-To:1': 0.24; 'url:bugs': 0.24; "i've": 0.25; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'chris': 0.26; 'fri,': 0.27; 'question': 0.27; 'actual': 0.28; 'sleep': 0.29; 'windows,': 0.29; 'character': 0.29; "i'm": 0.30; 'code': 0.30; 'certainly': 0.30; "can't": 0.32; 'language.': 0.32; 'run': 0.33; 'url:python': 0.33; 'curious': 0.33; 'file': 0.34; 'running': 0.34; 'maps': 0.35; 'something': 0.35; 'asking': 0.35; 'but': 0.36; 'should': 0.36; 'url:org': 0.36; 'data.': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; "won't": 0.38; 'why': 0.39; 'test': 0.39; 'to:addr:python.org': 0.40; 'mark': 0.40; 'still': 0.40; 'your': 0.60; 'skip:u 10': 0.61; 'avoid': 0.61; 'tracking': 0.61; 'charset:windows-1252': 0.62; 'minutes': 0.64; 'our': 0.64; 'between': 0.65; 'night': 0.67; 'talking': 0.67; 'complaint': 0.84; 'faster.': 0.84; 'piping': 0.84; 'pythonistas,': 0.84; 'subject:space': 0.84; 'url:cpython': 0.84; 'url:rev': 0.84; 'comment.': 0.91; 'subject:+': 0.91 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: 212.88.46.83 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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:100576 On 17/12/2015 23:18, Chris Angelico wrote: > On Fri, Dec 18, 2015 at 10:05 AM, Mark Lawrence wrote: >> The culprit character is hidden between "Issue #" and "20540" at line 400 of >> C:\Python35\Lib\multiprocessing\connection.py. >> https://bugs.python.org/issue20540 and >> https://hg.python.org/cpython/rev/125c24f47f3c refers. >> >> I'm asking as I've just spent 30 minutes tracking down why my debug code >> would bomb when running on 3.5, but not 2.7 or 3.2 through 3.4. > > I'm curious as to why this character should bomb your code at all - > it's in a comment. Is it that your program was expecting ASCII, or is > it something about that particular character? > I'm playing with ASTs and using the stdlib as test data. I was trying to avoid going down this particular route, but... A lot of it is down to Windows, as the actual complaint is:- six.print_(source) File "C:\Python35\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\u202f' in position 407: character maps to And as usual I've answered my own question. The cp1252 shows even if my console is set to 65001, *BUT* I'm piping the output to file as it's so much faster. Having taken five minutes to run the code without the pipe everything runs to completion. I suppose the original question still holds, but I for one certainly won't be losing any sleep over it. Talking of which, good night all :) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence