Odd json encoding erro

Wells thewellsoliver at gmail.com
Tue Dec 15 18:04:07 EST 2009


Sorry- more detail- the actual problem is an exception thrown when
running str() on the value, like so:

>>> a = u'St. Paul\u2019s School For Boys (MN) HS'
>>> print str(a)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in
position 8: ordinal not in range(128)

Is there some way to run str() against a unicode object?



More information about the Python-list mailing list