Nice unicode -> ascii translation?
crowell at mit.edu
crowell at mit.edu
Sun Aug 6 22:04:00 EDT 2006
I'm using the ID3 tag of an mp3 file to query musicbrainz to get their
sort-name for the artist. A simple example is "The Beatles" ->
MusicBrainz -> "Beatles, The". I then want to rename the mp3 file
using this information. However, I would like the filename to contain
only ascii characters, while musicbrainz gives unicode back. So far,
I've got something like:
>>> artist = u'B\xe9la Fleck'
>>> artist.encode('ascii', 'ignore')
'Bla Fleck'
However, I'd like to see the more sensible "Bela Fleck" instead of
dropping '\xe9' entirely. I believe this sort of translation can be
done using:
>>> artist.translate(XXXX)
The trick is finding the right XXXX. Has someone attempted this
before, or am I stuck writing my own solution?
More information about the Python-list
mailing list