Transplant: Fix wording and clarify that the IDNA codec operates on full domain names.

Before reading the code to check, I wasn't sure if it operated on
full domain names or just individual labels.
This commit is contained in:
R David Murray 2011-04-13 14:20:30 -04:00
parent 9b342c6fd4
commit a2472d28fd
1 changed files with 8 additions and 2 deletions

View File

@ -1201,8 +1201,12 @@ the user: The application should transparently convert Unicode domain labels to
IDNA on the wire, and convert back ACE labels to Unicode before presenting them IDNA on the wire, and convert back ACE labels to Unicode before presenting them
to the user. to the user.
Python supports this conversion in several ways: The ``idna`` codec allows to Python supports this conversion in several ways: the ``idna`` codec performs
convert between Unicode and the ACE. Furthermore, the :mod:`socket` module conversion between Unicode and ACE, separating an input string into labels
based on the separator characters defined in `section 3.1`_ (1) of :rfc:`3490`
and converting each label to ACE as required, and conversely separating an input
byte string into labels based on the ``.`` separator and converting any ACE
labels found into unicode. Furthermore, the :mod:`socket` module
transparently converts Unicode host names to ACE, so that applications need not transparently converts Unicode host names to ACE, so that applications need not
be concerned about converting host names themselves when they pass them to the be concerned about converting host names themselves when they pass them to the
socket module. On top of that, modules that have host names as function socket module. On top of that, modules that have host names as function
@ -1210,6 +1214,8 @@ parameters, such as :mod:`httplib` and :mod:`ftplib`, accept Unicode host names
(:mod:`httplib` then also transparently sends an IDNA hostname in the (:mod:`httplib` then also transparently sends an IDNA hostname in the
:mailheader:`Host` field if it sends that field at all). :mailheader:`Host` field if it sends that field at all).
.. _section 3.1: http://tools.ietf.org/html/rfc3490#section-3.1
When receiving host names from the wire (such as in reverse name lookup), no When receiving host names from the wire (such as in reverse name lookup), no
automatic conversion to Unicode is performed: Applications wishing to present automatic conversion to Unicode is performed: Applications wishing to present
such host names to the user should decode them to Unicode. such host names to the user should decode them to Unicode.