Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1a.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.019 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'explicit': 0.07; '%s"': 0.09; 'pretend': 0.09; 'subject:2.7': 0.09; 'cc:addr:python-list': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'non-ascii': 0.16; 'subject:unicode': 0.16; 'unicode.': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'cc:addr:python.org': 0.22; 'bytes': 0.24; 'text,': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'message- id:@mail.gmail.com': 0.30; '>>>>': 0.31; 'though.': 0.31; 'subject:time': 0.33; 'subject: (': 0.35; 'received:google.com': 0.35; 'subject:one': 0.36; 'clear': 0.37; 'nov': 0.38; 'pm,': 0.38; 'that,': 0.38; 'either': 0.39; 'even': 0.60; 'subject:more': 0.64; 'between': 0.67; '20,': 0.68; 'otten': 0.84; 'thing,': 0.91; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type:content-transfer-encoding; bh=ZkO8KfU/mQyqAdBIzc8xRXcug9ENGmujwINbn5/6kqg=; b=myzBgQInI9XBFaiAmIRn8F2olWJqqbAQp02shXQJ3tU2uIsT0qk+JTEL83iNIHtnlw s0Dz1Vue3U7vLUSfodMjioUemCs7GXxbBbyHnkOsiCr+QAjHylZR2DfNASl3cVt9kPN/ g+v3YtfuHW6auLf5Ejk8ut1IuScBUeOQrXQ50KLL39j05UqAfau7ToHwGTldW4SW5p50 sDNVa31bAPqlHKr8DA2hGehxiemuMpJnZPNjv2kxXP+a20QoYHFzNv0fyp6i//nmu69e VqK8j2NC7sEeqox5VfYoavINA6Hh09sOvIfrFMNo7kDZReJD9+G4JU4pVCMFn68Z1ghP eEWA== MIME-Version: 1.0 X-Received: by 10.42.96.198 with SMTP id k6mr7658332icn.7.1416487313271; Thu, 20 Nov 2014 04:41:53 -0800 (PST) In-Reply-To: References: Date: Thu, 20 Nov 2014 23:41:53 +1100 Subject: Re: python 2.7 and unicode (one more time) From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1416487322 news.xs4all.nl 2936 [2001:888:2000:d::a6]:35815 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:81072 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"=C3=BCblich", u"=C3=A4hnlich") > u'\xfcblich \xe4hnlich' >>>> u"%s %s" % (u"=C3=BCblich", u"=C3=A4hnlich") > 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