作者:
blc (Anemos)
2016-02-04 11:43:08只好用try解決了……
def try_to_unicode(text):
encs = ['iso-8859-1','iso-8859-2'] ## 可以任意增加編碼
#print("try: "+repr(text))
for i in encs:
try:
t = text.encode(i).decode('utf-8')
except UnicodeEncodeError:
continue
#print(" "+i+" is right code")
return t
return text
如果有更好的方法也請指教一下。