Issue 1012952: Standard exceptions are hostile to Unicode (original) (raw)

Issue1012952

Created on 2004-08-20 15:09 by mgedmin, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg22152 - (view) Author: Marius Gedminas (mgedmin) * Date: 2004-08-20 15:09
>>> e = ValueError(u"\u2639") >>> str(e) ... UnicodeEncodeError: 'ascii' codec can't encode character u'\u2639' in position 0: ordinal not in range(128) >>> unicode(e) ... UnicodeEncodeError: 'ascii' codec can't encode character u'\u2639' in position 0: ordinal not in range(128) Please add a __unicode__ method to Exception. I suggest the following semantics: class UnicodeAwareException(Exception): def __unicode__(self): return u" ".join(map(unicode, self.args))
msg22153 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2006-03-01 04:35
Logged In: YES user_id=357491 Rev. 42711 (PEP 352) adds a proper __unicode__ to the built-in exceptions.
History
Date User Action Args
2022-04-11 14:56:06 admin set github: 40794
2004-08-20 15:09:05 mgedmin create