A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2000-April/003216.html below:

[Python-Dev] Unicode as argument for 8-bit format strings

[Python-Dev] Unicode as argument for 8-bit format strings [Python-Dev] Unicode as argument for 8-bit format stringsGuido van Rossum guido@python.org
Fri, 07 Apr 2000 09:01:45 -0400
> There has been a bug report about the treatment of Unicode
> objects together with 8-bit format strings. The current
> implementation converts the Unicode object to UTF-8 and then
> inserts this value in place of the %s.... 
> 
> I'm inclined to change this to have '...%s...' % u'abc'
> return u'...abc...' since this is just another case of
> coercing data to the "bigger" type to avoid information loss.
> 
> Thoughts ?

Makes sense.  But note that it's going to be difficult to catch all
cases: you could have

'...%d...%s...%s...' % (3, "abc", u"abc")

and

'...%(foo)s...' % {'foo': u'abc'}

and even

'...%(foo)s...' % {'foo': 'abc', 'bar': u'def'}

(the latter should *not* convert to Unicode).

--Guido van Rossum (home page: http://www.python.org/~guido/)



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4