Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v9 / html / python / lib / module-encodings.idna.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="lib.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python Documentation Index' />
<link rel="first" href="lib.html" title='Python Library Reference' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="prev" href="standard-encodings.html" />
<link rel="parent" href="module-codecs.html" />
<link rel="next" href="module-unicodedata.html" />
<meta name='aesop' content='information' />
<title>4.9.3 encodings.idna -- Internationalized Domain Names in Applications</title>
</head>
<body>
<DIV CLASS="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="4.9.2 Standard Encodings"
href="standard-encodings.html"><img src='../icons/previous.png'
border='0' height='32' alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="4.9 codecs "
href="module-codecs.html"><img src='../icons/up.png'
border='0' height='32' alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="4.10 unicodedata "
href="module-unicodedata.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
href="contents.html"><img src='../icons/contents.png'
border='0' height='32' alt='Contents' width='32' /></A></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
border='0' height='32' alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
href="genindex.html"><img src='../icons/index.png'
border='0' height='32' alt='Index' width='32' /></A></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="standard-encodings.html">4.9.2 Standard Encodings</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-codecs.html">4.9 codecs </A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="module-unicodedata.html">4.10 unicodedata </A>
</div>
<hr /></div>
</DIV>
<!--End of Navigation Panel-->
<H2><A NAME="SECTION006930000000000000000">
4.9.3 <tt class="module">encodings.idna</tt> --
Internationalized Domain Names in Applications</A>
</H2>
<P>
<A NAME="module-encodings.idna"></A>
<P>
<span class="versionnote">New in version 2.3.</span>
<P>
This module implements <a class="rfc" id='rfcref-87091' xml:id='rfcref-87091'
href="http://www.faqs.org/rfcs/rfc3490.html">RFC 3490</a> (Internationalized Domain Names in
Applications) and <a class="rfc" id='rfcref-87093' xml:id='rfcref-87093'
href="http://www.faqs.org/rfcs/rfc3492.html">RFC 3492</a> (Nameprep: A Stringprep Profile for
Internationalized Domain Names (IDN)). It builds upon the
<code>punycode</code> encoding and <tt class="module"><a href="module-stringprep.html">stringprep</a></tt>.
<P>
These RFCs together define a protocol to support non-ASCII characters
in domain names. A domain name containing non-ASCII characters (such
as ``www.Alliancefran&#231;aise.nu'') is converted into an
ASCII-compatible encoding (ACE, such as
``www.xn-alliancefranaise-npb.nu''). The ACE form of the domain name
is then used in all places where arbitrary characters are not allowed
by the protocol, such as DNS queries, HTTP <span class="mailheader">Host:</span> fields, and so
on. This conversion is carried out in the application; if possible
invisible to 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 to the user.
<P>
Python supports this conversion in several ways: The <code>idna</code> codec
allows to convert between Unicode and the ACE. Furthermore, the
<tt class="module"><a href="module-socket.html">socket</a></tt> module 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 socket module. On top of
that, modules that have host names as function parameters, such as
<tt class="module"><a href="module-httplib.html">httplib</a></tt> and <tt class="module"><a href="module-ftplib.html">ftplib</a></tt>, accept Unicode host names
(<tt class="module"><a href="module-httplib.html">httplib</a></tt> then also transparently sends an IDNA hostname in
the <span class="mailheader">Host:</span> field if it sends that field at all).
<P>
When receiving host names from the wire (such as in reverse name
lookup), no automatic conversion to Unicode is performed: Applications
wishing to present such host names to the user should decode them to
Unicode.
<P>
The module <tt class="module">encodings.idna</tt> also implements the nameprep
procedure, which performs certain normalizations on host names, to
achieve case-insensitivity of international domain names, and to unify
similar characters. The nameprep functions can be used directly if
desired.
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-1019' xml:id='l2h-1019' class="function">nameprep</tt></b>(</nobr></td>
<td><var>label</var>)</td></tr></table></dt>
<dd>
Return the nameprepped version of <var>label</var>. The implementation
currently assumes query strings, so <code>AllowUnassigned</code> is
true.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-1020' xml:id='l2h-1020' class="function">ToASCII</tt></b>(</nobr></td>
<td><var>label</var>)</td></tr></table></dt>
<dd>
Convert a label to ASCII, as specified in <a class="rfc" id='rfcref-87095' xml:id='rfcref-87095'
href="http://www.faqs.org/rfcs/rfc3490.html">RFC 3490</a>.
<code>UseSTD3ASCIIRules</code> is assumed to be false.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-1021' xml:id='l2h-1021' class="function">ToUnicode</tt></b>(</nobr></td>
<td><var>label</var>)</td></tr></table></dt>
<dd>
Convert a label to Unicode, as specified in <a class="rfc" id='rfcref-87097' xml:id='rfcref-87097'
href="http://www.faqs.org/rfcs/rfc3490.html">RFC 3490</a>.
</dl>
<DIV CLASS="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="4.9.2 Standard Encodings"
href="standard-encodings.html"><img src='../icons/previous.png'
border='0' height='32' alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="4.9 codecs "
href="module-codecs.html"><img src='../icons/up.png'
border='0' height='32' alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="4.10 unicodedata "
href="module-unicodedata.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
href="contents.html"><img src='../icons/contents.png'
border='0' height='32' alt='Contents' width='32' /></A></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
border='0' height='32' alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
href="genindex.html"><img src='../icons/index.png'
border='0' height='32' alt='Index' width='32' /></A></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="standard-encodings.html">4.9.2 Standard Encodings</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-codecs.html">4.9 codecs </A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="module-unicodedata.html">4.10 unicodedata </A>
</div>
</div>
<hr />
<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>