This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: string.split shouldn't split on non-breaking spaces
Type: Stage:
Components: Interpreter Core Versions: Python 2.6
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, ericp
Priority: normal Keywords:

Created on 2009-07-21 20:00 by ericp, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg90770 - (view) Author: Eric Promislow (ericp) Date: 2009-07-21 20:00
ActivePython ...
>>> a = u"abc\x0adef"
>>> a.split()
[u'abc', u'def']

"\x0a" is a non-breaking space. This behavior means we can't
easily use split() to reflow text.
msg90771 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2009-07-21 20:04
split() is usually used to split words. To reflow text, use the textwrap
msg90772 - (view) Author: Eric Promislow (ericp) Date: 2009-07-21 20:19
Thanks.  For the record, I want

textwrap.TextWrapper(..., break_long_words=False)

or it will break after a non-breaking space if that
gives an optimum length.
Date User Action Args
2022-04-11 14:56:51adminsetgithub: 50786
2009-07-21 20:25:38benjamin.petersonsetstatus: open -> closed
2009-07-21 20:19:51ericpsetstatus: closed -> open

messages: + msg90772
2009-07-21 20:04:42benjamin.petersonsetstatus: open -> closed

nosy: + benjamin.peterson
messages: + msg90771

resolution: rejected
2009-07-21 20:00:50ericpcreate