[Python-bugs-list] [ python-Bugs-593581 ] u'%c' % large value: broken result
noreply@sourceforge.net
noreply@sourceforge.net
Sun, 11 Aug 2002 05:23:37 -0700
Bugs item #593581, was opened at 2002-08-11 04:35
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=593581&group_id=5470
Category: Unicode
Group: Python 2.2
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Guido van Rossum (gvanrossum)
Assigned to: M.-A. Lemburg (lemburg)
Summary: u'%c' % large value: broken result
Initial Comment:
The unicode implementation of '%c' % x does no range
checking on x, and out-of-range values can cause weird
effects. You might want to implement the same range
checking as 8-bit strings use, restricting x to values
in range(256). Or you might want to implement
unichr(x), restricting x to values in range(0xffff).
But right now it's a mess:
>>> u'%c' % 100
u'd'
>>> u'%c' % 300
u','
>>> u'%c' % 900
u'\uff84'
>>> u'%c' % -900
u'|'
>>>
----------------------------------------------------------------------
>Comment By: M.-A. Lemburg (lemburg)
Date: 2002-08-11 12:23
Message:
Logged In: YES
user_id=38388
Fix checked in. u"%c" will now apply the same checks as
unichr().
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=593581&group_id=5470