Path: csiph.com!x330-a1.tempe.blueboxinc.net!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'received:209.85.213.46': 0.07; 'received:mail-yw0-f46.google.com': 0.07; 'python': 0.07; 'utf-8': 0.09; '>>>': 0.12; 'am,': 0.14; 'wrote:': 0.14; 'subject:UTF': 0.16; 'subject:Unicode': 0.16; 'dec': 0.17; 'input': 0.18; 'cc:no real name:2**0': 0.20; 'cc:2**0': 0.20; 'cheers,': 0.20; 'seems': 0.21; 'variable': 0.21; '(or': 0.22; 'header:In-Reply-To:1': 0.22; 'cc:addr:python-list': 0.22; 'e.g.': 0.22; 'received:209.85.213': 0.23; 'similar,': 0.23; 'chris': 0.27; 'message-id:@mail.gmail.com': 0.28; 'sat,': 0.29; 'cc:addr:python.org': 0.31; 'nope,': 0.31; "skip:' 10": 0.32; "isn't": 0.34; 'print': 0.35; 'subject:/': 0.36; 'received:209.85': 0.37; 'subject:with': 0.37; 'received:google.com': 0.38; 'received:209': 0.39; "it's": 0.40; 'header:Received:5': 0.40; 'address': 0.61; '2011': 0.62; '2.7.1': 0.84; 'encoding?': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=wTDxJkB3LDNLNzo+E8ywMgctZ9q7gJ0dWjkf2CU+K40=; b=NPhfy2I1/qyb6lnUTdKhFM9gMBDnzqceWtYmMKo7970V6LCRkx7Hbv6otloF/P5bfe rTrtvs9xCPLIEAjPJwMFUUpfP3+EX4lJpksEKQezeTT6xFjspdFxm0VoukSPUbkbYIdA XOfZEBuxFODsHleogcZzDdefg6HUAPw9WW/GU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=aRhevesVC0kAquAWasbP2wj0w/PjHbm90QjWBSTKz87o+dJP8tOXB966K7DMdmnAna I+M7F2EMb+PKTl9PMHcRSyeaG1ujR02+iBcgSAugkE/Yxw/HX5aGA0YOQZIXz3LiiAaO aC2QTBTU/uJle6Jo4yKXBpcQAqHuvKRsCPHeY= MIME-Version: 1.0 Sender: chris@rebertia.com In-Reply-To: References: Date: Sat, 7 May 2011 07:14:55 -0700 X-Google-Sender-Auth: WG3F9k6q5dz592cghMhaYcTFJFo Subject: Re: Stuck with urllib.quote and Unicode/UTF-8 From: Chris Rebert To: Marian Steinbach Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 23 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1304777705 news.xs4all.nl 41103 [::ffff:82.94.164.166]:48338 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:4908 On Sat, May 7, 2011 at 5:35 AM, Marian Steinbach 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 =3D u"K=C3=B6ln" >>> x.encode('utf_8') 'K\xc3\xb6ln' >>> x.encode('latin_1') 'K\xf6ln' >>> Cheers, Chris -- http://rebertia.com