encode short string as filename (unix/windows)

nikie n.estner at gmx.de
Mon Mar 27 18:14:07 CEST 2006

> 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?
> or which characters are not allowed in filenames on typical OS?

On Windows, / \ : * ?  " < > | are forbidden, and the name can't be

Using urlsafe_b64encode/...decode should work on any platform.

More information about the Python-list mailing list