Frage

I am pulling text from an Excel document and adding them as id3 tags to some mp3 files. Most of the characters in my Excel document are Russian (Unicode) but some are in English. When I run the script, all the English tags get written as meta data correctly, but all the Russian characters show up as question marks. If I print the Russian characters in my console, they show up perfectly. Why are they getting written as question marks?

Python

from mutagen.easyid3 import EasyID3
import xlrd
import glob
import re
import os
for name in glob.glob('*.mp3'):
  audio = EasyID3(name)
  wb = xlrd.open_workbook('xl.xls')
  sh = wb.sheet_by_name(u'Russian')
  col_b = 1
  col_c = 2
  col_e = 4
  col_g = 6
  col_i = 8
  col_k = 10
  for i in range(sh.nrows):
    row = sh.row_values(i)
    for j in range(len(row)):
      if row[j] == name:
        audio["title"] = sh.cell(i,col_e).value
        audio["author"] = sh.cell(i,col_i).value
        audio["copyright"] = sh.cell(i,col_g).value
        audio["album"] = sh.cell(i,col_k).value
        audio["discsubtitle"] = sh.cell(i,col_c).value
        audio.save()
print "All MP3 MetaData Parsed!"
War es hilfreich?

Lösung

you should use 'decode' or/and 'encode' methods.

The great answer about: https://stackoverflow.com/a/370199/1321404

anoter way: https://stackoverflow.com/a/4631545/1321404

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top