enhance to_unicode for windows charset

This commit is contained in:
Christophe Benz 2010-12-01 15:37:15 +01:00
commit b517adfed1

View file

@ -41,12 +41,14 @@ def to_unicode(text):
try:
text = str(text)
except UnicodeError:
return unicode(text)
pass
try:
return unicode(text, "utf8")
return unicode(text, 'utf-8')
except UnicodeError:
pass
return unicode(text, "ISO-8859-1")
try:
return unicode(text, 'iso-8859-1')
except UnicodeError:
return unicode(text, 'windows-1252')
def local2utc(d):
d = d.replace(tzinfo=tz.tzlocal())