fix unicode issues

This commit is contained in:
Romain Bignon 2010-12-01 15:22:47 +01:00
commit a42f75700a
2 changed files with 7 additions and 4 deletions

View file

@ -38,7 +38,10 @@ def to_unicode(text):
if isinstance(text, unicode):
return text
if not isinstance(text, str):
text = str(text)
try:
text = str(text)
except UnicodeError:
return unicode(text)
try:
return unicode(text, "utf8")
except UnicodeError: