Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: Should stdlib files contain 'narrow non breaking space' U+202F? Date: Fri, 18 Dec 2015 11:16:49 +1100 Lines: 26 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de FE2LKntlndmlmj5C7YRSoA85/n98JkLKyxwz12YgU62Q== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; "subject:' ": 0.07; 'utf-8': 0.07; 'cc:addr:python-list': 0.09; 'assumed': 0.09; 'encode': 0.09; 'subject:files': 0.09; 'stored': 0.10; 'python': 0.10; 'output': 0.13; 'question.': 0.13; '3.0)': 0.16; 'codec': 0.16; 'cp1252': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'losing': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'specified.': 0.16; 'subject:breaking': 0.16; 'subject:non': 0.16; 'which,': 0.16; 'wrote:': 0.16; 'runs': 0.18; 'windows': 0.20; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'skip:" 30': 0.20; 'lawrence': 0.22; 'pipe': 0.22; 'suppose': 0.22; 'text,': 0.22; 'am,': 0.23; 'dec': 0.23; 'header:In-Reply-To:1': 0.24; "i've": 0.25; 'fri,': 0.27; 'question': 0.27; 'message-id:@mail.gmail.com': 0.27; 'actual': 0.28; 'received:209.85.213.174': 0.29; 'sleep': 0.29; 'windows,': 0.29; 'character': 0.29; "i'm": 0.30; 'code': 0.30; 'certainly': 0.30; "can't": 0.32; 'run': 0.33; 'source': 0.33; 'suddenly': 0.33; 'windows.': 0.33; 'file': 0.34; 'handle': 0.34; 'that,': 0.34; 'received:google.com': 0.35; 'maps': 0.35; 'unicode': 0.35; 'but': 0.36; 'too': 0.36; 'received:209.85': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'received:209.85.213': 0.37; "won't": 0.38; 'received:209': 0.38; 'mark': 0.40; 'still': 0.40; 'skip:u 10': 0.61; 'minutes': 0.64; 'night': 0.67; 'talking': 0.67; '11:02': 0.84; 'chrisa': 0.84; 'complaint': 0.84; 'faster.': 0.84; 'piping': 0.84; 'subject:space': 0.84; 'to:none': 0.91; 'subject:+': 0.91 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:cc :content-type; bh=6v4+mWX6pWMNL08MAh3yIpTibsJ5+Skzde2gD9z3u2g=; b=dHpphyMdqw5edtJowa1pmI9pMFJZB4iolNq6uMsFhlL3LMaJTrLbFRik0hUi83N7Ce 0qcxPgGAm2IAYnrp9z9hdRYdQgpDka6Tnw6v64X3gc2BPli3bfoxq2ORdshk6dSdxfKe y+9sZAvN07TRMeVsdysujt7+tVarPmKIIRwKjSFYAd0oJ3FM+GiPX5Id8yG/0OQ6WYUT 5CJ7ibJ6Wr8izieRox7r7gAwb/Oh0bCfs3nnVfSweW+SpZuK9DOD/sxNq/6k5Vpbea3y 8I8Hm0gOzaVxZJgDnaFwVOYOQiyirEFFe/QEJEymSbVCyclqmw+9JMkk8ZOR8F9SEn7E B5mQ== X-Received: by 10.50.70.38 with SMTP id j6mr272894igu.13.1450397809550; Thu, 17 Dec 2015 16:16:49 -0800 (PST) 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:100577 On Fri, Dec 18, 2015 at 11:02 AM, Mark Lawrence wrote: > 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 :) Oh. Windows. Suddenly it all makes sense. Python source code is (as of 3.0) Unicode text, and is assumed to be stored as UTF-8 if not otherwise specified. If Windows can't handle that, too bad for Windows. ChrisA