=== modified file 'xl/metadata/_id3.py' --- xl/metadata/_id3.py 2009-08-25 21:35:45 +0000 +++ xl/metadata/_id3.py 2009-10-09 11:50:16 +0000 @@ -31,6 +31,21 @@ from mutagen import id3 import logging logger = logging.getLogger(__name__) +import locale +if str(locale.getdefaultlocale()[0]).startswith('zh'): + _unicode=unicode + def unicode(string, encoding='utf8',errors='strict'): + try: + string.decode('utf8').encode('iso8859-1') + except: + return _unicode(string) + string = string.decode('utf8').encode('iso8859-1') + for enc in ('utf8', 'gb2312', 'big5', 'gb18030', 'big5hkscs', 'euc-jp', 'euc_kr', 'cp1251', 'utf16'): + try: + return string.decode(enc) + except: + pass + return string class ID3Format(BaseFormat): MutagenType = id3.ID3