2009/4/27 Cameron Simpson <c...@zip.com.au>:
>
> PROPOSAL: add to the PEP the following functions:
>
>  os.fsdecode(bytes) -> funny-encoded Unicode
>    This is what os.listdir() does to produce the strings it hands out.
>  os.fsencode(funny-string) -> bytes
>    This is what open(filename,..) does to turn the filename into bytes
>    for the POSIX open.
>  os.pathencode(your-string) -> funny-encoded-Unicode
>    This is what you must do to a de novo string to turn it into a
>    string suitable for use by open.
>    Importantly, for most strings not hand crafted to have weird
>    sequences in them, it is a no-op. But it will recode your puns
>    for survival.
>
> and for me, I would like to see:
>
>  os.setfilesystemencoding(coding)
>
> Currently os.getfilesystemencoding() returns you the encoding based on
> the current locale, and (I trust) the os.* stuff encodes on that basis.
> setfilesystemencoding() would override that, unless coding==None in what
> case it reverts to the former "use the user's current locale" behaviour.
> (We have locale "C" for what one might otherwise expect None to mean:-)

Time machine! 
http://docs.python.org/dev/py3k/library/sys.html#sys.setfilesystemencoding



-- 
Regards,
Benjamin
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to