[Python-bugs-list] [ python-Bugs-824947 ] strip on chr(0x1f) different with unicode

SourceForge.net noreply at sourceforge.net
Fri Oct 17 10:43:31 EDT 2003


Bugs item #824947, was opened at 2003-10-16 18:37
Message generated for change (Comment added) made by lemburg
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=824947&group_id=5470

Category: Unicode
Group: Python 2.3
>Status: Closed
>Resolution: Rejected
Priority: 5
Submitted By: Thomas B Hickey (thomasbhickey)
Assigned to: M.-A. Lemburg (lemburg)
Summary: strip on chr(0x1f) different with unicode

Initial Comment:
chr(0x1f) gets stripped from Unicode strings, but not 
from regular strings.  I don't believe either should strip 
it.

Python 2.3.1 (#47, Sep 23 2003, 23:47:32) [MSC 
v.1200 32 bit (Intel)] on win32

>>> sd = chr(0x1f)
>>> sd.strip()
'\x1f'
>>> unicode(sd).strip()
u''




----------------------------------------------------------------------

>Comment By: M.-A. Lemburg (lemburg)
Date: 2003-10-17 16:43

Message:
Logged In: YES 
user_id=38388

Walter explained it all.

----------------------------------------------------------------------

Comment By: Walter Dörwald (doerwalter)
Date: 2003-10-17 15:49

Message:
Logged In: YES 
user_id=89016

The problem is that "\x1f" (UNIT SEPARATOR) is considered a
space in str.isspace(), but not in unicode.isspace():
>>> u"\x1f".isspace()
True
>>> "\x1f".isspace()
False

For str, isspace() from the OS is used, but for unicode
iswspace() or the unicode database is used.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=824947&group_id=5470



More information about the Python-bugs-list mailing list