Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3a.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'read.': 0.03; 'encoding': 0.05; 'subject:Python': 0.06; 'encoded': 0.07; 'suppose': 0.07; 'bytes.': 0.09; 'pages.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'vast': 0.09; 'python': 0.11; 'assumptions': 0.16; 'encodings': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'routinely': 0.16; 'url:pocoo': 0.16; 'worse.': 0.16; 'files.': 0.16; 'java,': 0.16; 'trying': 0.19; 'seems': 0.21; 'example': 0.22; 'preferred': 0.22; 'header:User-Agent:1': 0.23; 'browsers': 0.24; 'bytes': 0.24; 'issue,': 0.24; "shouldn't": 0.24; 'unicode': 0.24; 'decide': 0.24; 'java': 0.24; 'least': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'characters': 0.30; 'especially': 0.30; 'clever': 0.31; 'convenience': 0.31; 'implicit': 0.31; 'subject:some': 0.31; 'probably': 0.32; 'figure': 0.32; 'something': 0.35; 'convert': 0.35; 'etc': 0.35; 'operations': 0.35; 'but': 0.35; 'there': 0.35; 'really': 0.36; 'url:org': 0.36; 'should': 0.36; 'easily': 0.37; 'sometimes': 0.38; 'to:addr:python-list': 0.38; 'anything': 0.39; 'skip:. 10': 0.39; 'url:12': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'even': 0.60; 'read': 0.60; 'most': 0.60; 'today.': 0.61; 'url:5': 0.61; 'mentioned': 0.61; 'become': 0.64; 'land': 0.65; 'media': 0.66; 'due': 0.66; 'default': 0.69; 'computers': 0.72; 'received:109': 0.72; 'forced': 0.84; "they'd": 0.84; 'url:2014': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Robin Becker Subject: Re: Python 3.2 has some deadly infection Date: Mon, 02 Jun 2014 12:10:48 +0100 References: <538a8f48$0$29978$c3e8da3$5496439d@news.astraweb.com> <538bcfff$0$29978$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 109.174.168.73 User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 In-Reply-To: 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: 35 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1401707464 news.xs4all.nl 2881 [2001:888:2000:d::a6]:44041 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:72405 ............ > > I probably should have mentioned it, but in my case it's not even Python > (Java). It's exactly the same principal - an assumption was made that has > become entrenched due to the fear of breakage. If they'd been forced to > think about encodings up-front, it shouldn't have been an issue, which was > the point I was trying to make. > there seems to be an implicit assumption in python land that encoded strings are the norm. On virtually every computer I encounter that assumption is wrong. The vast majority of bytes in most computers is not something that can be easily printed out for humans to read. I suppose some clever pythonista can figure out an encoding to read my .o / .so etc files, but they are practically meaningless to a unicode program today. Same goes for most image formats and media files. Browsers routinely encounter mis/un-encoded pages. > In Java, it's much worse. At least with Python you can perform string-like > operations on bytes. In Java you have to convert it to characters before > you can really do anything with it, so people just use the default encoding > all the time - especially if they want the convenience of line-by-line > reading using BufferedReader ... .. In python I would have preferred for bytes to remain the default io mechanism, at least that would allow me to decide if I need any decoding. As the cat example http://lucumr.pocoo.org/2014/5/12/everything-about-unicode/ showed these extra assumptions are sometimes really in the way. -- Robin Becker