encode short string as filename (unix/windows)

Diez B. Roggisch deets at nospam.web.de
Mon Mar 27 18:13:17 CEST 2006

robert wrote:

> want to encode/decode an arbitrary short 8-bit string as save filename.
> is there a good already builtin encoding to do this (without too much
> inflation) ? or re.sub expression?

Yuu could use the base64-encoder. Disadvantage is clearly that you can't
easily read your original text. Alternatively, three is that encoding that
is used by e.g. emails if you have an umlaut in a name. I _think_ it is
called puny-code, but I'm not sure how and if you can use that from within
python - google yourself :)


More information about the Python-list mailing list