[Python-checkins] r81167 - in python/branches/release26-maint: Doc/c-api/unicode.rst
victor.stinner
python-checkins at python.org
Fri May 14 17:55:12 CEST 2010
Author: victor.stinner
Date: Fri May 14 17:55:12 2010
New Revision: 81167
Log:
Merged revisions 81166 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r81166 | victor.stinner | 2010-05-14 17:53:20 +0200 (ven., 14 mai 2010) | 4 lines
Issue #8711: add paragraph titles to c-api/unicode.rst
(Python2 doesn't have PyUnicode_DecodeFSDefault*() functions)
........
Modified:
python/branches/release26-maint/ (props changed)
python/branches/release26-maint/Doc/c-api/unicode.rst
Modified: python/branches/release26-maint/Doc/c-api/unicode.rst
==============================================================================
--- python/branches/release26-maint/Doc/c-api/unicode.rst (original)
+++ python/branches/release26-maint/Doc/c-api/unicode.rst Fri May 14 17:55:12 2010
@@ -11,11 +11,12 @@
^^^^^^^^^^^^^^^
+Unicode Type
+""""""""""""
+
These are the basic Unicode object types used for the Unicode implementation in
Python:
-.. % --- Unicode Type -------------------------------------------------------
-
.. ctype:: Py_UNICODE
@@ -105,12 +106,13 @@
.. versionadded:: 2.6
+Unicode Character Properties
+""""""""""""""""""""""""""""
+
Unicode provides many different character properties. The most often needed ones
are available through these macros which are mapped to C functions depending on
the Python configuration.
-.. % --- Unicode character properties ---------------------------------------
-
.. cfunction:: int Py_UNICODE_ISSPACE(Py_UNICODE ch)
@@ -196,11 +198,13 @@
Return the character *ch* converted to a double. Return ``-1.0`` if this is not
possible. This macro does not raise exceptions.
+
+Plain Py_UNICODE
+""""""""""""""""
+
To create Unicode objects and access their basic sequence properties, use these
APIs:
-.. % --- Plain Py_UNICODE ---------------------------------------------------
-
.. cfunction:: PyObject* PyUnicode_FromUnicode(const Py_UNICODE *u, Py_ssize_t size)
@@ -258,8 +262,11 @@
Support is optimized if Python's own :ctype:`Py_UNICODE` type is identical to
the system's :ctype:`wchar_t`.
-.. % --- wchar_t support for platforms which support it ---------------------
+wchar_t Support
+"""""""""""""""
+
+wchar_t support for platforms which support it:
.. cfunction:: PyObject* PyUnicode_FromWideChar(const wchar_t *w, Py_ssize_t size)
@@ -312,9 +319,11 @@
The codecs all use a similar interface. Only deviation from the following
generic ones are documented for simplicity.
-These are the generic codec APIs:
-.. % --- Generic Codecs -----------------------------------------------------
+Generic Codecs
+""""""""""""""
+
+These are the generic codec APIs:
.. cfunction:: PyObject* PyUnicode_Decode(const char *s, Py_ssize_t size, const char *encoding, const char *errors)
@@ -351,9 +360,11 @@
the Python codec registry. Return *NULL* if an exception was raised by the
codec.
-These are the UTF-8 codec APIs:
-.. % --- UTF-8 Codecs -------------------------------------------------------
+UTF-8 Codecs
+""""""""""""
+
+These are the UTF-8 codec APIs:
.. cfunction:: PyObject* PyUnicode_DecodeUTF8(const char *s, Py_ssize_t size, const char *errors)
@@ -396,9 +407,11 @@
object. Error handling is "strict". Return *NULL* if an exception was raised
by the codec.
-These are the UTF-32 codec APIs:
-.. % --- UTF-32 Codecs ------------------------------------------------------ */
+UTF-32 Codecs
+"""""""""""""
+
+These are the UTF-32 codec APIs:
.. cfunction:: PyObject* PyUnicode_DecodeUTF32(const char *s, Py_ssize_t size, const char *errors, int *byteorder)
@@ -471,9 +484,10 @@
.. versionadded:: 2.6
-These are the UTF-16 codec APIs:
+UTF-16 Codecs
+"""""""""""""
-.. % --- UTF-16 Codecs ------------------------------------------------------ */
+These are the UTF-16 codec APIs:
.. cfunction:: PyObject* PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors, int *byteorder)
@@ -552,9 +566,11 @@
string always starts with a BOM mark. Error handling is "strict". Return
*NULL* if an exception was raised by the codec.
-These are the "Unicode Escape" codec APIs:
-.. % --- Unicode-Escape Codecs ----------------------------------------------
+Unicode-Escape Codecs
+"""""""""""""""""""""
+
+These are the "Unicode Escape" codec APIs:
.. cfunction:: PyObject* PyUnicode_DecodeUnicodeEscape(const char *s, Py_ssize_t size, const char *errors)
@@ -584,9 +600,11 @@
string object. Error handling is "strict". Return *NULL* if an exception was
raised by the codec.
-These are the "Raw Unicode Escape" codec APIs:
-.. % --- Raw-Unicode-Escape Codecs ------------------------------------------
+Raw-Unicode-Escape Codecs
+"""""""""""""""""""""""""
+
+These are the "Raw Unicode Escape" codec APIs:
.. cfunction:: PyObject* PyUnicode_DecodeRawUnicodeEscape(const char *s, Py_ssize_t size, const char *errors)
@@ -616,11 +634,13 @@
Python string object. Error handling is "strict". Return *NULL* if an exception
was raised by the codec.
+
+Latin-1 Codecs
+""""""""""""""
+
These are the Latin-1 codec APIs: Latin-1 corresponds to the first 256 Unicode
ordinals and only these are accepted by the codecs during encoding.
-.. % --- Latin-1 Codecs -----------------------------------------------------
-
.. cfunction:: PyObject* PyUnicode_DecodeLatin1(const char *s, Py_ssize_t size, const char *errors)
@@ -648,11 +668,13 @@
object. Error handling is "strict". Return *NULL* if an exception was raised
by the codec.
+
+ASCII Codecs
+""""""""""""
+
These are the ASCII codec APIs. Only 7-bit ASCII data is accepted. All other
codes generate errors.
-.. % --- ASCII Codecs -------------------------------------------------------
-
.. cfunction:: PyObject* PyUnicode_DecodeASCII(const char *s, Py_ssize_t size, const char *errors)
@@ -680,9 +702,11 @@
object. Error handling is "strict". Return *NULL* if an exception was raised
by the codec.
-These are the mapping codec APIs:
-.. % --- Character Map Codecs -----------------------------------------------
+Character Map Codecs
+""""""""""""""""""""
+
+These are the mapping codec APIs:
This codec is special in that it can be used to implement many different codecs
(and this is in fact what was done to obtain most of the standard codecs
@@ -765,7 +789,9 @@
DBCS) is a class of encodings, not just one. The target encoding is defined by
the user settings on the machine running the codec.
-.. % --- MBCS codecs for Windows --------------------------------------------
+
+MBCS codecs for Windows
+"""""""""""""""""""""""
.. cfunction:: PyObject* PyUnicode_DecodeMBCS(const char *s, Py_ssize_t size, const char *errors)
@@ -804,8 +830,9 @@
object. Error handling is "strict". Return *NULL* if an exception was raised
by the codec.
-.. % --- Methods & Slots ----------------------------------------------------
+Methods & Slots
+"""""""""""""""
.. _unicodemethodsandslots:
More information about the Python-checkins
mailing list