Issue622831
Created on 2002-10-14 04:07 by rdmurray, last changed 2002-12-09 16:33 by gward.
| Messages | |||
|---|---|---|---|
| msg12767 (view) | Author: R. David Murray (rdmurray) | Date: 2002-10-14 04:07 | |
I don't know if this is a module bug or a documentation bug. I'm
using the documentation from the manual on python.org.
>>> x = TextWrapper()
>>> x.wrap(u'abcd')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/local/lib/python2.3/textwrap.py", line 239, in wrap
text = self._munge_whitespace(text)
File "/usr/local/lib/python2.3/textwrap.py", line 99, in _munge_whitespace
text = text.translate(self.whitespace_trans)
TypeError: character mapping must return integer, None or unicode
If you do x.replace_whitespace = True, then it will wrap the text.
So either whitespace replacement needs to be fixed, or the docs
need to be updated to note that you have to set replace_whitespace
to false if you want to wrap unicode.
|
|||
| msg12768 (view) | Author: Martin v. Löwis (loewis) | Date: 2002-10-14 12:48 | |
Logged In: YES user_id=21627 Greg, can you take a look? |
|||
| msg12769 (view) | Author: Greg Ward (gward) | Date: 2002-10-22 18:30 | |
Logged In: YES user_id=14422 I'm almost competely ignorant of Unicode, and so is textwrap.py. I'll try to get help on python-dev to fix this, or figure it out myself. Failing that, the inability to handle Unicode should be documented. |
|||
| msg12770 (view) | Author: Greg Ward (gward) | Date: 2002-12-09 16:24 | |
Logged In: YES user_id=14422 Hopefully fixed in rev 1.19 of textwrap.py. Not in test suite yet, so I'm leaving this one "pending". |
|||
| msg12771 (view) | Author: Greg Ward (gward) | Date: 2002-12-09 16:33 | |
Logged In: YES user_id=14422 OK, tested in rev 1.18 of test/test_textwrap.py. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2002-10-14 04:07:44 | rdmurray | create | |