Iñigo Serna wrote: > On 8/18/06, Tim Daneliuk <[EMAIL PROTECTED]> wrote: >> > try mutagen. >> http://www.sacredchao.net/quodlibet/wiki/Development/Mutagen >> >> This module is more-or-less exactly what I needed. However, I am running >> into problems when the filenames or ID tags have unicode characters in >> them. >> >> Typically, I do something like: >> >> from mutagen.easyid3 import EasyID3 >> >> audio["title'] = Something based on the filename that has unicode >> chars in it >> >> I then get this: >> >> UnicodeDecodeError: 'ascii' codec can't decode byte 0xfc in position >> 56: ordinal not in range(128) > >> From the docs: > """Mutagen has full Unicode support for all formats. When you assign > text strings, we strongly recommend using Python unicode objects > rather than str objects. If you use str objects, Mutagen will assume > they are in UTF-8.""" > > So I suppose the value you try to assign as title is not unicode, > check the encoding used in the file system. > > Iñigo
I am trying to set the title based on the filename. The file is in a Win32 NTFS filesystem, so it could have non-ASCII chars in it. What I am stumbling on it how to coerce it into unicode. I have tried: name = filename.split(....) blah blah blah audio["title"] = unicode(name) But I still get this error. I am not real up to speed on the whole unicode end of things, so any kind suggestions would be most welcome. By the way, I believe the offending string contains a German umlaut, at least in one of the cases. Similarly, when I just try to *read* a tag, I get these kinds of errors: print audio["title"] Will sometimes choke ... Thanks for the help.. -- ---------------------------------------------------------------------------- Tim Daneliuk [EMAIL PROTECTED] PGP Key: http://www.tundraware.com/PGP/ -- http://mail.python.org/mailman/listinfo/python-list