Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!bcyclone03.am1.xlned.com!bcyclone03.am1.xlned.com!newsfeed.xs4all.nl!newsfeed2a.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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '21,': 0.07; 'encoded': 0.07; 'string': 0.09; 'bytes.': 0.09; 'subject:2.7': 0.09; 'python': 0.11; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'subject:unicode': 0.16; 'unicode.': 0.16; 'subject:python': 0.16; 'exception': 0.16; 'folks': 0.16; 'fix': 0.17; 'wrote:': 0.18; 'properly': 0.19; '>>>': 0.22; 'header:User- Agent:1': 0.23; 'bytes': 0.24; 'unicode': 0.24; 'header:In-Reply- To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'errors': 0.30; 'fri,': 0.33; 'subject:time': 0.33; 'subject: (': 0.35; 'skip:u 20': 0.35; 'subject:one': 0.36; 'clear': 0.37; 'message-id:@gmail.com': 0.38; 'nov': 0.38; 'to:addr:python-list': 0.38; 'that,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'even': 0.60; 'skip:u 10': 0.60; 'subject:more': 0.64; 'more': 0.64; 'hang': 0.67; 'otten': 0.84 X-Virus-Scanned: amavisd-new at torriefamily.org Date: Thu, 20 Nov 2014 09:51:15 -0700 From: Michael Torrie User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131118 Thunderbird/17.0.11 MIME-Version: 1.0 To: python-list@python.org Subject: Re: python 2.7 and unicode (one more time) References: <1416491999.209592.193345213.3A6FF9A4@webmail.messagingengine.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1416502283 news.xs4all.nl 2866 [2001:888:2000:d::a6]:44409 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 3596 X-Received-Body-CRC: 2307474622 Xref: csiph.com comp.lang.python:81089 On 11/20/2014 09:32 AM, Peter Otten wrote: > Chris Angelico wrote: > >> On Fri, Nov 21, 2014 at 2:40 AM, Peter Otten <__peter__@web.de> wrote: >>> I think that you may get a Unicode/Encode/Error when you try to /decode/ >>> a unicode string is more confusing... >> >> Hang on a minute, what does it even mean to decode a Unicode string? > > Let's not get philosophical ;) It's not philosophical. It's an important distinction that folks need to be clear on when understanding unicode and the errors that python can throw. Unicode can only be encoded to bytes. Bytes can only be decoded to unicode. Without understanding that, the exception errors about decoding won't be properly understood, nor will one know how to fix them.