Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
579a358e
Commit
579a358e
authored
Sep 18, 2009
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#6930: clarify description about byteorder handling in UTF decoder routines.
parent
54967d99
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
12 deletions
+17
-12
Doc/c-api/unicode.rst
Doc/c-api/unicode.rst
+17
-12
No files found.
Doc/c-api/unicode.rst
View file @
579a358e
...
...
@@ -414,10 +414,13 @@ These are the UTF-32 codec APIs:
*byteorder == 0: native order
*byteorder == 1: big endian
and then switches if the first four bytes of the input data are a byte order mark
(BOM) and the specified byte order is native order. This BOM is not copied into
the resulting Unicode string. After completion, *\*byteorder* is set to the
current byte order at the end of input data.
If ``*byteorder`` is zero, and the first four bytes of the input data are a
byte order mark (BOM), the decoder switches to this byte order and the BOM is
not copied into the resulting Unicode string. If ``*byteorder`` is ``-1`` or
``1``, any byte order mark is copied to the output.
After completion, *\*byteorder* is set to the current byte order at the end
of input data.
In a narrow build codepoints outside the BMP will be decoded as surrogate pairs.
...
...
@@ -442,8 +445,7 @@ These are the UTF-32 codec APIs:
.. cfunction:: PyObject* PyUnicode_EncodeUTF32(const Py_UNICODE *s, Py_ssize_t size, const char *errors, int byteorder)
Return a Python bytes object holding the UTF-32 encoded value of the Unicode
data in *s*. If *byteorder* is not ``0``, output is written according to the
following byte order::
data in *s*. Output is written according to the following byte order::
byteorder == -1: little endian
byteorder == 0: native byte order (writes a BOM mark)
...
...
@@ -487,10 +489,14 @@ These are the UTF-16 codec APIs:
*byteorder == 0: native order
*byteorder == 1: big endian
and then switches if the first two bytes of the input data are a byte order mark
(BOM) and the specified byte order is native order. This BOM is not copied into
the resulting Unicode string. After completion, *\*byteorder* is set to the
current byte order at the.
If ``*byteorder`` is zero, and the first two bytes of the input data are a
byte order mark (BOM), the decoder switches to this byte order and the BOM is
not copied into the resulting Unicode string. If ``*byteorder`` is ``-1`` or
``1``, any byte order mark is copied to the output (where it will result in
either a ``\ufeff`` or a ``\ufffe`` character).
After completion, *\*byteorder* is set to the current byte order at the end
of input data.
If *byteorder* is *NULL*, the codec starts in native order mode.
...
...
@@ -520,8 +526,7 @@ These are the UTF-16 codec APIs:
.. cfunction:: PyObject* PyUnicode_EncodeUTF16(const Py_UNICODE *s, Py_ssize_t size, const char *errors, int byteorder)
Return a Python string object holding the UTF-16 encoded value of the Unicode
data in *s*. If *byteorder* is not ``0``, output is written according to the
following byte order::
data in *s*. Output is written according to the following byte order::
byteorder == -1: little endian
byteorder == 0: native byte order (writes a BOM mark)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment