我正在嘗試使用各種編碼 - 一些utf-8,一些ISO-8859-2,一些ASCII等等的一些文件。是否有可靠的解碼方式以標準編碼進行處理?如何可靠地將各種編碼解碼爲系統默認編碼
我曾嘗試以下:
import chardet
encoding = chardet.detect(text)
text = unicode(text,encoding['encoding']).decode(sys.getdefaultencoding(),'ignore')
與上面的代碼我仍然得到UnicodeEncodeError錯誤
您可能還想看看[that](http:// stackoverflow .com/questions/368805 /)的問題。 – tzot 2010-11-29 13:41:59