Wanted: safe codec for filenames

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Wed Sep 5 22:35:36 EDT 2007


En Wed, 05 Sep 2007 19:20:45 -0300, Torsten Bronger  
<bronger at physik.rwth-aachen.de> escribi�:

> Torsten Bronger writes:
>
>> I'd like to map general unicode strings to safe filename.  I tried
>> punycode but it is case-sensitive, which Windows is not.  Thus,
>> "Hallo" and "hallo" are mapped to "Hallo-" and "hallo-", however,
>> I need uppercase Latin letters being encoded, too, and the
>> encoding must contain only lowercase Latin letters, numbers,
>> underscores, and maybe a little bit more.  The result should be
>> more legible than base64, though.
>
> Okay, the following works fine for me:

Nice codec. Altough if one is looking for really portable file names,  
there are additional rules, collected here  
http://www.boost.org/libs/filesystem/doc/portability_guide.htm
Hard to comply with all the character set rules *and* keep all name  
lengths below the limits.

-- 
Gabriel Genellina




More information about the Python-list mailing list