coding utf-8 from mutagen easyid3 import EasyID3 import chardet audio

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# -*- coding: utf-8 -*-
from mutagen.easyid3 import EasyID3
import chardet
audio = EasyID3("syava_feat._vitya_ak_-_ne_blatuy.mp3")
print audio['title'][0].decode("UTF-8").encode("iso-8859-15").decode("cp1251")
Traceback (most recent call last):
File "enc.py", line 8, in <module>
print audio['title'][0].decode("UTF-8").encode("iso-8859-15").decode("cp1251")
File "/usr/lib/python2.5/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)