Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.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; 'charset:iso-8859-7': 0.04; 'encoding': 0.05; 'string': 0.09; 'bash': 0.09; 'f.close()': 0.09; 'filename': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'skip:\\ 40': 0.09; 'strings.': 0.09; 'python': 0.11; '"w")': 0.16; 'filename,': 0.16; 'interpreter,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:issue': 0.16; 'wrote:': 0.18; 'file,': 0.19; 'header:User-Agent:1': 0.23; 'error': 0.23; 'byte': 0.24; 'source': 0.25; 'header:X-Complaints- To:1': 0.27; 'lines': 0.31; '>>>>': 0.31; 'file': 0.32; 'run': 0.32; 'text': 0.33; 'actual': 0.34; 'but': 0.35; 'example,': 0.37; 'starting': 0.37; 'checks': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'above,': 0.60; 'consists': 0.60; 'dave': 0.60; 'first': 0.61; 'skip:f 50': 0.65; 'angel': 0.91; 'contents.': 0.91; 'opens': 0.91; 'examine': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dave Angel Subject: Re: UnicodeDecodeError issue Date: Mon, 2 Sep 2013 18:28:36 +0000 (UTC) References: <5222fc40$0$6599$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-7 Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: 174.32.174.36 User-Agent: XPN/1.2.6 (Street Spirit ; Linux) 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: 41 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1378146537 news.xs4all.nl 15945 [2001:888:2000:d::a6]:47474 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:53522 On 2/9/2013 11:05, Ferrous Cranus wrote: > Óôéò 2/9/2013 3:21 ìì, ï/ç Dave Angel Ýãñáøå: >> Starting with the byte string in the error message: >>>>> f = open("junk.txt", "w") >>>>> f.write(b'\xb6\xe3\xed\xf9\xf3\xf4\xef\xfc\xed\xef\xec\xe1 \xf3\xf5\xf3\xf4\xde\xec\xe1\xf4\xef\xf2\n') >>>>> f.close() > > > Éndeed but yet again, file checks out the encoding of the filename that > consists of these lines above, not of the actual strings. > > 'file' does nothing interesting with the filename, it just opens it and examines the contents. For example, file www/cgi-bin/files.py will examine the Python source file, not run it. So first in the interpreter, I ran >>>> f = open("junk.txt", "w") >>>> f.write(b'\xb6\xe3\xed\xf9\xf3\xf4\xef\xfc\xed\xef\xec\xe1 \xf3\xf5\xf3\xf4\xde\xec\xe1\xf4\xef\xf2\n') >>>> f.close() then at the bash prompt, I ran: davea@think2:~$ file junk.txt junk.txt: ISO-8859 text davea@think2:~$ -- DaveA