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


Groups > comp.lang.python > #81072

Re: python 2.7 and unicode (one more time)

References <m4kcu8$ta8$1@ger.gmane.org> <m4kn66$ma3$1@ger.gmane.org>
Date 2014-11-20 23:41 +1100
Subject Re: python 2.7 and unicode (one more time)
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.16016.1416487322.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Thu, Nov 20, 2014 at 11:35 PM, Peter Otten <__peter__@web.de> wrote:
> You don't need to change an all-ascii bytestring to unicode.
> Lo and behold:
>
>>>> "%s %s" % (u"üblich", u"ähnlich")
> u'\xfcblich \xe4hnlich'
>>>> u"%s %s" % (u"üblich", u"ähnlich")
> u'\xfcblich \xe4hnlich'
>
> Only non-ascii bytestrings mean trouble, either noisy
>

It's better to not depend on that, though. Be clear and explicit about
the difference between bytes and text, and don't try to pretend
they're the same thing, even for ASCII.

ChrisA

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


Thread

Re: python 2.7 and unicode (one more time) Chris Angelico <rosuav@gmail.com> - 2014-11-20 23:41 +1100

csiph-web