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


Groups > comp.lang.python > #81101

Re: python 2.7 and unicode (one more time)

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!bcyclone03.am1.xlned.com!bcyclone03.am1.xlned.com!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'anyway.': 0.05; 'encoding': 0.05; 'encoded': 0.07; 'ascii': 0.09; 'subject:2.7': 0.09; 'blindly': 0.16; 'failure.': 0.16; 'str,': 0.16; 'subject:unicode': 0.16; 'unicode,': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'error': 0.23; 'unicode': 0.24; 'header:In-Reply-To:1': 0.27; 'correct': 0.29; 'am,': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; 'object.': 0.31; 'safely': 0.31; 'subject:time': 0.33; 'subject: (': 0.35; "can't": 0.35; 'received:google.com': 0.35; 'subject:one': 0.36; 'nov': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'either': 0.39; 'happen': 0.63; 'subject:more': 0.64; '20,': 0.68; 'silent': 0.95
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=A8HNgdiwGqJhVXkYo7BtF1C+nugceTyly1GI0U3CTyw=; b=A2Xe/Uz+vsqWi2HELSwE71wqfgniptkjw+A8uowGVX4AahfPjbXzHmDlgiTbTQwWIz tZknAc9ZcQxW/zOZD/0o+K40IIOQAJLbbb6tRzQOZfCTQ24HO+nbUc21I55/eSvwv2RG azpFJnyODCm+HeQb9AcZCHS0/HRgtyOZtaAGhyhyZoeU75JEVY5JLsf+T/SKTp1PPYzN Ku9Vb1eLgVpJteg1qDwF0WwY5d+ZD4CCdXCDiejhn2/Bv15k8O8AE+SipZCPCTYqTkQK yQi1KPfjFL7q5pgqKOo6Gj+GdWoZDBjuW2CBFLkkYXuPNVN7Id45FjyrjMiv5Tu4zqD1 0fyw==
X-Received by 10.70.102.234 with SMTP id fr10mr10047292pdb.145.1416506839953; Thu, 20 Nov 2014 10:07:19 -0800 (PST)
MIME-Version 1.0
In-Reply-To <1416505379.268157.193439717.66E319D4@webmail.messagingengine.com>
References <m4kcu8$ta8$1@ger.gmane.org> <m4kn66$ma3$1@ger.gmane.org> <1416491999.209592.193345213.3A6FF9A4@webmail.messagingengine.com> <CAPTjJmr5NWMFCfU8jaNd2g2f9cQ1y+zO3qT7yVcC_m9vKXN6fw@mail.gmail.com> <1416505379.268157.193439717.66E319D4@webmail.messagingengine.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Thu, 20 Nov 2014 11:06:39 -0700
Subject Re: python 2.7 and unicode (one more time)
To Python <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.16038.1416506849.18130.python-list@python.org> (permalink)
Lines 9
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1416506849 news.xs4all.nl 2955 [2001:888:2000:d::a6]:53230
X-Complaints-To abuse@xs4all.nl
X-Received-Bytes 3684
X-Received-Body-CRC 3780648700
Xref csiph.com comp.lang.python:81101

Show key headers only | View raw


On Thu, Nov 20, 2014 at 10:42 AM,  <random832@fastmail.us> wrote:
> and it means you can't safely
> blindly use %s with an unknown object.

You can't safely do this anyway. Whether it's %s with a str and a
unicode, or %s with a unicode and a str, *something* is going to have
to be implicitly encoded or decoded, and if ascii doesn't happen to be
the correct encoding then the result will be either an error or a
silent failure.

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


Thread

Re: python 2.7 and unicode (one more time) Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-20 11:06 -0700

csiph-web