Add references.
This commit is contained in:
parent
dae1bae5ad
commit
d99932829d
24
pep-0383.txt
24
pep-0383.txt
|
@ -64,18 +64,19 @@ Specification
|
|||
|
||||
On Windows, Python uses the wide character APIs to access
|
||||
character-oriented APIs, allowing direct conversion of the
|
||||
environmental data to Python str objects.
|
||||
environmental data to Python str objects ([1]).
|
||||
|
||||
On POSIX systems, Python currently applies the locale's encoding to
|
||||
convert the byte data to Unicode, failing for characters that cannot
|
||||
be decoded. With this PEP, non-decodable bytes will be represented as
|
||||
lone half surrogate codes U+DCxx.
|
||||
|
||||
To convert non-decodable bytes, a new error handler "python-escape" is
|
||||
introduced, which produces these half surrogates. On encoding, the
|
||||
error handler converts the half surrogate back to the corresponding
|
||||
byte. This error handler will be used in any API that receives or
|
||||
produces file names, command line arguments, or environment variables.
|
||||
To convert non-decodable bytes, a new error handler ([2])
|
||||
"python-escape" is introduced, which produces these half
|
||||
surrogates. On encoding, the error handler converts the half surrogate
|
||||
back to the corresponding byte. This error handler will be used in any
|
||||
API that receives or produces file names, command line arguments, or
|
||||
environment variables.
|
||||
|
||||
The error handler interface is extended to allow the encode error
|
||||
handler to return byte strings immediately, in addition to returning
|
||||
|
@ -122,6 +123,17 @@ for accepting and returning bytes, would be written as::
|
|||
# fn is now a str object
|
||||
yield fn.encode(fse, "python-escape")
|
||||
|
||||
References
|
||||
==========
|
||||
|
||||
[1] PEP 277
|
||||
"Unicode file name support for Windows NT"
|
||||
http://www.python.org/dev/peps/pep-0277/
|
||||
|
||||
[2] PEP 293
|
||||
"Codec Error Handling Callbacks"
|
||||
http://www.python.org/dev/peps/pep-0293/
|
||||
|
||||
Copyright
|
||||
=========
|
||||
|
||||
|
|
Loading…
Reference in New Issue