Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #4908
| References | <BANLkTikCvzh0GOKhgZy8yOzpi3DZ5RspNw@mail.gmail.com> <BANLkTi=qBG+emGYO-MXaebdSKyVzZVGDyA@mail.gmail.com> |
|---|---|
| Date | 2011-05-07 07:14 -0700 |
| Subject | Re: Stuck with urllib.quote and Unicode/UTF-8 |
| From | Chris Rebert <clp2@rebertia.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1290.1304777705.9059.python-list@python.org> (permalink) |
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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Stuck with urllib.quote and Unicode/UTF-8 Chris Rebert <clp2@rebertia.com> - 2011-05-07 07:14 -0700
csiph-web