eyed3 がTAGをUTF-8決め打ちで返す件の対策
http://pc8.2ch.net/test/read.cgi/tech/1141964987/327
def fix_str(s): try: #utf-8のunicode文字列を通常文字列に変換 buf = "".join([chr(ord(x)) for x in s]) except ValueError: #utf-16のunicode文字列が来たときはencodeで変換 buf = s.encode("mbcs") return buf tag = eyeD3.Tag() tag.link('test.mp3') title = fix_str(tag.getTitle()) converted = nkf('-w', title) print converted
ネタもとはこれかな。
http://www.ginganet.org/ginga/memo/python-id3/
http://d.hatena.ne.jp/tomoemon/20060429#p4