On Tue, Dec 15, 2009 at 3:04 PM, Wells <thewellsoli...@gmail.com> wrote: > 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?
To repeat what I said earlier, you use the .encode() method instead: print a.encode('utf8') Might I recommend reading: http://www.joelonsoftware.com/articles/Unicode.html Regards, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list