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


Groups > comp.lang.python > #4908 > unrolled thread

Re: Stuck with urllib.quote and Unicode/UTF-8

Started byChris Rebert <clp2@rebertia.com>
First post2011-05-07 07:14 -0700
Last post2011-05-07 07:14 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Stuck with urllib.quote and Unicode/UTF-8 Chris Rebert <clp2@rebertia.com> - 2011-05-07 07:14 -0700

#4908 — Re: Stuck with urllib.quote and Unicode/UTF-8

FromChris Rebert <clp2@rebertia.com>
Date2011-05-07 07:14 -0700
SubjectRe: Stuck with urllib.quote and Unicode/UTF-8
Message-ID<mailman.1290.1304777705.9059.python-list@python.org>
On Sat, May 7, 2011 at 5:35 AM, Marian Steinbach <marian@sendung.de> wrote:
> An addition/correction:
>
> It seems as if my input variable address is not Unicode. This is what
> I get for print [address]:
>
> ['K\xf6ln, Nordrhein-Westfalen']
>
> Isn't this utf-8 encoding?

Nope, it's Latin-1 (or similar, e.g. Windows-1252):
Python 2.7.1 (r271:86832, Dec  5 2010, 00:12:20)
>>> x = u"Köln"
>>> x.encode('utf_8')
'K\xc3\xb6ln'
>>> x.encode('latin_1')
'K\xf6ln'
>>>

Cheers,
Chris
--
http://rebertia.com

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web