enhance to_unicode for windows charset
This commit is contained in:
parent
a42f75700a
commit
b517adfed1
1 changed files with 6 additions and 4 deletions
|
|
@ -41,12 +41,14 @@ def to_unicode(text):
|
||||||
try:
|
try:
|
||||||
text = str(text)
|
text = str(text)
|
||||||
except UnicodeError:
|
except UnicodeError:
|
||||||
return unicode(text)
|
pass
|
||||||
try:
|
try:
|
||||||
return unicode(text, "utf8")
|
return unicode(text, 'utf-8')
|
||||||
except UnicodeError:
|
except UnicodeError:
|
||||||
pass
|
try:
|
||||||
return unicode(text, "ISO-8859-1")
|
return unicode(text, 'iso-8859-1')
|
||||||
|
except UnicodeError:
|
||||||
|
return unicode(text, 'windows-1252')
|
||||||
|
|
||||||
def local2utc(d):
|
def local2utc(d):
|
||||||
d = d.replace(tzinfo=tz.tzlocal())
|
d = d.replace(tzinfo=tz.tzlocal())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue