fix unicode and exceptions

This commit is contained in:
Christophe Benz 2010-12-01 15:37:59 +01:00
commit b042b4b7f6
2 changed files with 3 additions and 6 deletions

View file

@ -38,10 +38,7 @@ def to_unicode(text):
if isinstance(text, unicode):
return text
if not isinstance(text, str):
try:
text = str(text)
except UnicodeError:
pass
text = str(text)
try:
return unicode(text, 'utf-8')
except UnicodeError: