Ticket #5028: utils_encoding_repr.diff
File utils_encoding_repr.diff, 569 bytes (added by , 17 years ago) |
---|
-
utils/encoding.py
37 37 if hasattr(s, '__unicode__'): 38 38 s = unicode(s) 39 39 else: 40 s = unicode(str(s), encoding, errors) 40 try: 41 s = str(s) 42 except UnicodeError: 43 s = repr(s) 44 s = unicode(s, encoding, errors) 41 45 elif not isinstance(s, unicode): 42 46 s = unicode(s, encoding, errors) 43 47 return s