On 2013.05.07 17:37, Jens Thoms Toerring wrote: > You > could e.g. replace all characters not allowed by the file > system by their hexidecimal (ASCII) values, preceeded by a > '%" (so '/' would be changed to '%2F', and also encode a '%' > itself in a name by '%25'). Then you have a well-defined > two-way mapping ("isomorphic" if I remember my math-lear- > nining days correctly) between the original name and the > way you store it. E.g. > > "C/A/T" would become "C%2FA%2FT" > > and > > "C%2FA/T" would become "C%252FA%2FT" > > You can translate back and forth between them with not too > much effort. > > Of course, that assumes that '%' is a character allowed by > your file system - otherwise pick some other one, any one > will do in principle. It's a bit harder for a human to in- > terpret but rathe likely not that much of a problem. Yes, something like this is what I am trying to achieve. Judging by the responses I've gotten so far, I think I'll have to roll my own transformation scheme since URL encoding and the like transform Unicode characters. I can memorize that 植松伸夫 is a Japanese composer who is well-known for his works in the Final Fantasy series of video games. Trying to match up the URL-encoded version to an artist would be almost impossible when I have several other artist names that have no ASCII characters.
-- CPython 3.3.1 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list