Making safe file names

Andrew Berg bahamutzero8825 at gmail.com
Tue May 7 19:00:43 EDT 2013


On 2013.05.07 17:01, Terry Jan Reedy wrote:
> Sounds like you want something like the html escape or urlencode 
> functions, which serve the same purpose of encoding special chars. 
> Rather than invent a new tranformation, you could use the same scheme 
> used for html entities. (Sorry, I forget the details.) It is possible 
> that one of the functions would work for you as is, or with little 
> modification.
This has the problem of mangling non-ASCII characters (and artist names with non-ASCII characters are not rare). I most definitely want to
keep as many characters untouched as possible so that the files are easy to identify by looking at the file name. Ideally, only characters
that file systems don't like would be transformed.

-- 
CPython 3.3.1 | Windows NT 6.2.9200 / FreeBSD 9.1



More information about the Python-list mailing list