A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-April/089095.html below:

Non-decodable Bytes in System Character Interfaces

[Python-Dev] PEP 383: Non-decodable Bytes in System Character Interfaces [Python-Dev] PEP 383: Non-decodable Bytes in System Character InterfacesBenjamin Peterson benjamin at python.org
Tue Apr 28 04:58:34 CEST 2009
2009/4/27 Cameron Simpson <cs at 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
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4