Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'subject:Windows': 0.02; 'encoding': 0.05; 'subject:Python': 0.06; '"""': 0.07; 'encoded': 0.07; 'utf-8': 0.07; 'string': 0.09; '2.3,': 0.09; 'bytes.': 0.09; 'editor.': 0.09; 'input,': 0.09; 'processing,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'release.': 0.09; 'runs': 0.10; 'python': 0.11; 'windows': 0.15; 'declaration': 0.16; 'declaration;': 0.16; 'encoding.': 0.16; 'file;': 0.16; 'fine.': 0.16; 'internally': 0.16; 'literals': 0.16; 'non-ascii': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'release?': 0.16; 'url:peps': 0.16; 'utf8': 0.16; 'wrote:': 0.18; 'obviously': 0.18; 'code,': 0.22; 'input': 0.22; 'header:User-Agent:1': 0.23; 'error': 0.23; '2.2': 0.24; 'byte': 0.24; 'bytes': 0.24; 'finally,': 0.24; 'sends': 0.24; 'subject:release': 0.24; 'unicode': 0.24; 'url:dev': 0.24; 'file.': 0.24; '(or': 0.24; 'source': 0.25; 'header:X-Complaints-To:1': 0.27; "doesn't": 0.30; 'see,': 0.30; 'code': 0.31; 'comments,': 0.31; 'file': 0.32; 'run': 0.32; 'linux': 0.33; 'url:python': 0.33; 'running': 0.33; 'could': 0.34; 'except': 0.35; 'editor': 0.35; 'but': 0.35; 'add': 0.35; 'version': 0.36; 'hi,': 0.36; 'url:org': 0.36; 'changing': 0.37; 'two': 0.37; 'step': 0.37; 'mine': 0.38; 'to:addr:python- list': 0.38; 'files': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'remove': 0.60; 'tell': 0.60; 'introduced': 0.61; 'completed': 0.61; 'provide': 0.64; 'between': 0.67; 'default': 0.69; 'friend': 0.79; '2.5.': 0.84; 'treating': 0.84; 'issued': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Peter Otten <__peter__@web.de> Subject: Re: Python Windows release and encoding Date: Wed, 22 May 2013 14:39:15 +0200 Organization: None References: <519cb599$0$2290$426a74cc@news.free.fr> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Gmane-NNTP-Posting-Host: p508481a5.dip0.t-ipconnect.de User-Agent: KNode/4.7.3 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: 54 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1369226349 news.xs4all.nl 15975 [2001:888:2000:d::a6]:37135 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:45727 Absalom K. wrote: > Hi, I am working on Linux; a friend of mine sends to me python files from > his Windows release. He uses the editor coming with the release; he runs > his code from the editor by using a menu (or some F5 key I think). > > He doesn't declare any encoding in his source file; when I want to try > his code, I have an error since he obviously uses non-ascii characters. > As far as I can see, he uses utf8 without knowing it. I add the UTF8 > declaration, run the code, and everything is fine. > > Then I tell him to add the utf-8 declaration; but now he has an error > when running his file from the Windows editor. > > Finally, he told me he could run the file by declaring the latin-1 > encoding. > > But I want to understand exactly: > a) what is the encoding used by the editor coming in the Windows > release? b) why doesn't he need to declare the encoding (I need it on > Linux for > the very same files)? > > Best regards, ak. Your friend may be using an old version of Python. Quoting """ For backwards-compatibility with existing code which currently uses non-ASCII in string literals without declaring an encoding, the implementation will be introduced in two phases: 1. Allow non-ASCII in string literals and comments, by internally treating a missing encoding declaration as a declaration of "iso-8859-1". This will cause arbitrary byte strings to correctly round-trip between step 2 and step 5 of the processing, and provide compatibility with Python 2.2 for Unicode literals that contain non-ASCII bytes. A warning will be issued if non-ASCII bytes are found in the input, once per improperly encoded input file. 2. Remove the warning, and change the default encoding to "ascii". [...] Implementation of steps 1 and 2 above were completed in 2.3, except for changing the default encoding to "ascii". The default encoding was set to "ascii" in version 2.5. """