Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #81082

Re: python 2.7 and unicode (one more time)

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
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; 'memory.': 0.07; 'string': 0.09; '%s"': 0.09; 'encode': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'strings.': 0.09; 'subject:2.7': 0.09; 'codec': 0.16; 'n\xc3\xb6tig': 0.16; 'ordinal': 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; 'subject:unicode': 0.16; 'surprising': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'thu,': 0.19; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'byte': 0.24; 'string,': 0.24; 'unicode': 0.24; 'header:X-Complaints-To:1': 0.27; 'mix': 0.30; 'easier': 0.31; '"",': 0.31; 'idea,': 0.31; 'file': 0.32; 'probably': 0.32; '(most': 0.33; 'subject:time': 0.33; 'subject: (': 0.35; "can't": 0.35; 'skip:u 20': 0.35; 'but': 0.35; 'subject:one': 0.36; 'nov': 0.38; 'to:addr:python-list': 0.38; 'rather': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'skip:u 10': 0.60; 'save': 0.62; 'subject:more': 0.64; 'more': 0.64; '20,': 0.68; '2014,': 0.84; 'otten': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Peter Otten <__peter__@web.de>
Subject Re: python 2.7 and unicode (one more time)
Date Thu, 20 Nov 2014 16:40 +0100
Organization None
References <m4kcu8$ta8$1@ger.gmane.org> <m4kn66$ma3$1@ger.gmane.org> <1416491999.209592.193345213.3A6FF9A4@webmail.messagingengine.com>
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding 8Bit
X-Gmane-NNTP-Posting-Host p57bdbd17.dip0.t-ipconnect.de
User-Agent KNode/4.13.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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.16024.1416498018.18130.python-list@python.org> (permalink)
Lines 19
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1416498018 news.xs4all.nl 2977 [2001:888:2000:d::a6]:45199
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:81082

Show key headers only | View raw


random832@fastmail.us wrote:

> On Thu, Nov 20, 2014, at 07:35, Peter Otten wrote:
>> >>> "%s nötig %s" % (u"üblich", u"ähnlich")
>> Traceback (most recent call last):
>>   File "<stdin>", line 1, in <module>
>> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 4:
>> ordinal not in range(128)
> 
> This is surprising to me - why is it trying to decode the format string,
> rather than encode the arguments?

Probably to make it easier to mix byte and unicode strings. In hindsight it 
may not have been a good idea, but it had the potential to save some memory.

I think that you may get a Unicode/Encode/Error when you try to /decode/ a 
unicode string is more confusing...

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: python 2.7 and unicode (one more time) Peter Otten <__peter__@web.de> - 2014-11-20 16:40 +0100

csiph-web