[XML-SIG] Catalog.py - is it possible to convert playlists to unicode on-the-fly?

Jack Grahl mnvl16 at yahoo.co.uk
Mon Jul 28 18:58:22 CEST 2008


Hi there,

I have had serpentine choke on an .m3u playlist which, closer inspection revealed, had filenames which included special characters in iso-latin-1 encoding. The files themselves had, i believe, their filenames automatically converted to the same characters in utf-8 encoding. (This was the result of ripping mp3s on a Windows machine and transferring the files)

I looked into the code a little bit and found that the playlist decoding mechanism is in /usr/lib/python2.5/site-packages/Ft/Xml/Catalog.py. The first place that python chokes on a non-unicode string is at line 332, however the 'uri' string is used at many places after that. 

Now, I understand that the module has no obligation to make sense of a playlist which does not use the same encoding as the filename in question, and so in fact points to a file which to all intents and purposes isn't there. However as the behaviour is a little difficult for the end user to deal with, I wondered if it would be possible to make modifications to the code so that, in the event of the playlist files not being found, it guesses at an alternate encoding, translates the string to utf-8 based on that guess, and looks for the new filenames? Obviously it's not difficult to check that such a guess is right if the files in question do exist.

If anyone has any advice as to whether this is a good idea, and how to implement it, I would be very grateful.

Yours, Jack Grahl



      __________________________________________________________
Not happy with your email address?.
Get the one you really want - millions of new email addresses available now at Yahoo! http://uk.docs.yahoo.com/ymail/new.html


More information about the XML-SIG mailing list