<html lang="en">
<head>
<title>GNU Libidn 1.18</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="GNU Libidn 1.18">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="top" href="#Top">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
This manual is last updated 5 February 2010 for version
1.18 of GNU Libidn.
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Simon Josefsson.
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License,
Version 1.3 or any later version published by the Free Software
Foundation; with no Invariant Sections, no Front-Cover Texts, and
no Back-Cover Texts. A copy of the license is included in the
section entitled "GNU Free Documentation License".
-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
body {
margin: 2%;
padding: 0 5%;
background: #ffffff;
}
h1,h2,h3,h4,h5 {
font-weight: bold;
padding: 5px 5px 5px 5px;
background-color: #c2e0ff;
color: #336699;
}
h1 {
padding: 2em 2em 2em 5%;
color: white;
background: #336699;
text-align: center;
letter-spacing: 3px;
}
h2 { text-decoration: underline; }
pre {
margin: 0 5%;
padding: 0.5em;
}
pre.example {
border: solid 1px;
background: #eeeeff;
padding-bottom: 1em;
}
pre.verbatim {
border: solid 1px gray;
background: white;
padding-bottom: 1em;
}
div.node {
margin: 0 -5% 0 -2%;
padding: 0.5em 0.5em;
margin-top: 0.5em;
margin-bottom: 0.5em;
font-weight: bold;
}
dd, li {
padding-top: 0.1em;
padding-bottom: 0.1em;
}
--></style>
</head>
<body>
<h1 class="settitle">GNU Libidn 1.18</h1>
<div class="contents">
<h2>Table of Contents</h2>
<ul>
<li><a name="toc_Top" href="#Top">GNU Libidn</a>
<li><a name="toc_Introduction" href="#Introduction">1 Introduction</a>
<ul>
<li><a href="#Getting-Started">1.1 Getting Started</a>
<li><a href="#Features">1.2 Features</a>
<li><a href="#Library-Overview">1.3 Library Overview</a>
<li><a href="#Supported-Platforms">1.4 Supported Platforms</a>
<li><a href="#Getting-help">1.5 Getting help</a>
<li><a href="#Commercial-Support">1.6 Commercial Support</a>
<li><a href="#Downloading-and-Installing">1.7 Downloading and Installing</a>
<ul>
<li><a href="#Installing-under-Windows">1.7.1 Installing under Windows</a>
</li></ul>
<li><a href="#Bug-Reports">1.8 Bug Reports</a>
<li><a href="#Contributing">1.9 Contributing</a>
</li></ul>
<li><a name="toc_Preparation" href="#Preparation">2 Preparation</a>
<ul>
<li><a href="#Header">2.1 Header</a>
<li><a href="#Initialization">2.2 Initialization</a>
<li><a href="#Version-Check">2.3 Version Check</a>
<li><a href="#Building-the-source">2.4 Building the source</a>
<li><a href="#Autoconf-tests">2.5 Autoconf tests</a>
<li><a href="#Memory-handling-under-Windows">2.6 Memory handling under Windows</a>
<li><a href="#Memory-handling-under-Windows">2.7 Header file <code>idn-free.h</code></a>
<li><a href="#Memory-handling-under-Windows">2.8 Memory de-allocation function</a>
</li></ul>
<li><a name="toc_Utility-Functions" href="#Utility-Functions">3 Utility Functions</a>
<ul>
<li><a href="#Utility-Functions">3.1 Header file <code>stringprep.h</code></a>
<li><a href="#Utility-Functions">3.2 Unicode Encoding Transformation</a>
<li><a href="#Utility-Functions">3.3 Unicode Normalization</a>
<li><a href="#Utility-Functions">3.4 Character Set Conversion</a>
</li></ul>
<li><a name="toc_Stringprep-Functions" href="#Stringprep-Functions">4 Stringprep Functions</a>
<ul>
<li><a href="#Stringprep-Functions">4.1 Header file <code>stringprep.h</code></a>
<li><a href="#Stringprep-Functions">4.2 Defining A Stringprep Profile</a>
<li><a href="#Stringprep-Functions">4.3 Control Flags</a>
<li><a href="#Stringprep-Functions">4.4 Core Functions</a>
<li><a href="#Stringprep-Functions">4.5 Error Handling</a>
<li><a href="#Stringprep-Functions">4.6 Stringprep Profile Macros</a>
</li></ul>
<li><a name="toc_Punycode-Functions" href="#Punycode-Functions">5 Punycode Functions</a>
<ul>
<li><a href="#Punycode-Functions">5.1 Header file <code>punycode.h</code></a>
<li><a href="#Punycode-Functions">5.2 Unicode Code Point Data Type</a>
<li><a href="#Punycode-Functions">5.3 Core Functions</a>
<li><a href="#Punycode-Functions">5.4 Error Handling</a>
</li></ul>
<li><a name="toc_IDNA-Functions" href="#IDNA-Functions">6 IDNA Functions</a>
<ul>
<li><a href="#IDNA-Functions">6.1 Header file <code>idna.h</code></a>
<li><a href="#IDNA-Functions">6.2 Control Flags</a>
<li><a href="#IDNA-Functions">6.3 Prefix String</a>
<li><a href="#IDNA-Functions">6.4 Core Functions</a>
<li><a href="#IDNA-Functions">6.5 Simplified ToASCII Interface</a>
<li><a href="#IDNA-Functions">6.6 Simplified ToUnicode Interface</a>
<li><a href="#IDNA-Functions">6.7 Error Handling</a>
</li></ul>
<li><a name="toc_TLD-Functions" href="#TLD-Functions">7 TLD Functions</a>
<ul>
<li><a href="#TLD-Functions">7.1 Header file <code>tld.h</code></a>
<li><a href="#TLD-Functions">7.2 Core Functions</a>
<li><a href="#TLD-Functions">7.3 Utility Functions</a>
<li><a href="#TLD-Functions">7.4 High-Level Wrapper Functions</a>
<li><a href="#TLD-Functions">7.5 Error Handling</a>
</li></ul>
<li><a name="toc_PR29-Functions" href="#PR29-Functions">8 PR29 Functions</a>
<ul>
<li><a href="#PR29-Functions">8.1 Header file <code>pr29.h</code></a>
<li><a href="#PR29-Functions">8.2 Core Functions</a>
<li><a href="#PR29-Functions">8.3 Utility Functions</a>
<li><a href="#PR29-Functions">8.4 Error Handling</a>
</li></ul>
<li><a name="toc_Examples" href="#Examples">9 Examples</a>
<ul>
<li><a href="#Example-1">9.1 Example 1</a>
<li><a href="#Example-2">9.2 Example 2</a>
<li><a href="#Example-3">9.3 Example 3</a>
<li><a href="#Example-4">9.4 Example 4</a>
<li><a href="#Example-5">9.5 Example 5</a>
</li></ul>
<li><a name="toc_Invoking-idn" href="#Invoking-idn">10 Invoking idn</a>
<ul>
<li><a href="#Invoking-idn">10.1 Name</a>
<li><a href="#Invoking-idn">10.2 Description</a>
<li><a href="#Invoking-idn">10.3 Options</a>
<li><a href="#Invoking-idn">10.4 Environment Variables</a>
<li><a href="#Invoking-idn">10.5 Examples</a>
<li><a href="#Invoking-idn">10.6 Troubleshooting</a>
</li></ul>
<li><a name="toc_Emacs-API" href="#Emacs-API">11 Emacs API</a>
<ul>
<li><a href="#Emacs-API">11.1 Punycode Emacs API</a>
<li><a href="#Emacs-API">11.2 IDNA Emacs API</a>
</li></ul>
<li><a name="toc_Java-API" href="#Java-API">12 Java API</a>
<ul>
<li><a href="#Java-API">12.1 Overview</a>
<li><a href="#Java-API">12.2 Miscellaneous Programs</a>
<ul>
<li><a href="#Java-API">12.2.1 GenerateRFC3454</a>
<li><a href="#Java-API">12.2.2 GenerateNFKC</a>
<li><a href="#Java-API">12.2.3 TestIDNA</a>
<li><a href="#Java-API">12.2.4 TestNFKC</a>
</li></ul>
<li><a href="#Java-API">12.3 Possible Problems</a>
<li><a href="#Java-API">12.4 A Note on Java and Unicode</a>
</li></ul>
<li><a name="toc_C_0023-API" href="#C_0023-API">13 C# API</a>
<li><a name="toc_Acknowledgements" href="#Acknowledgements">14 Acknowledgements</a>
<li><a name="toc_History" href="#History">15 History</a>
<li><a name="toc_PR29-discussion" href="#PR29-discussion">Appendix A PR29 discussion</a>
<li><a name="toc_On-Label-Separators" href="#On-Label-Separators">Appendix B On Label Separators</a>
<ul>
<li><a href="#On-Label-Separators">B.1 Recommended Workaround</a>
</li></ul>
<li><a name="toc_Copying-Information" href="#Copying-Information">Appendix C Copying Information</a>
<ul>
<li><a href="#GNU-Free-Documentation-License">C.1 GNU Free Documentation License</a>
<li><a href="#GNU-LGPL">C.2 GNU Lesser General Public License</a>
<li><a href="#GNU-GPL">C.3 GNU General Public License</a>
</li></ul>
<li><a name="toc_Function-and-Variable-Index" href="#Function-and-Variable-Index">Function and Variable Index</a>
<li><a name="toc_Concept-Index" href="#Concept-Index">Concept Index</a>
</li></ul>
</div>
<div class="node">
<a name="Top"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Introduction">Introduction</a>,
Up: <a rel="up" accesskey="u" href="#dir">(dir)</a>
</div>
<h2 class="unnumbered">GNU Libidn</h2>
<p>This manual is last updated 5 February 2010 for version
1.18 of GNU Libidn.
<p>Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Simon Josefsson.
<blockquote>
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
copy of the license is included in the section entitled “GNU Free
Documentation License”.
</blockquote>
<ul class="menu">
<li><a accesskey="1" href="#Introduction">Introduction</a>: How to use this manual.
<li><a accesskey="2" href="#Preparation">Preparation</a>: What you should do before using the library.
<li><a accesskey="3" href="#Utility-Functions">Utility Functions</a>: Unicode transformation utility functions.
<li><a accesskey="4" href="#Stringprep-Functions">Stringprep Functions</a>: Stringprep functions.
<li><a accesskey="5" href="#Punycode-Functions">Punycode Functions</a>: Punycode functions.
<li><a accesskey="6" href="#IDNA-Functions">IDNA Functions</a>: IDNA functions.
<li><a accesskey="7" href="#TLD-Functions">TLD Functions</a>: TLD functions.
<li><a accesskey="8" href="#PR29-Functions">PR29 Functions</a>: Detect strings non-idempotent under NFKC.
<li><a accesskey="9" href="#Examples">Examples</a>: Demonstrate how to use the library.
<li><a href="#Invoking-idn">Invoking idn</a>: Command line interface to the library.
<li><a href="#Emacs-API">Emacs API</a>: Emacs Lisp API for Libidn.
<li><a href="#Java-API">Java API</a>: Notes on the Java port of Libidn.
<li><a href="#C_0023-API">C# API</a>: Notes on the C# port of Libidn.
<li><a href="#Acknowledgements">Acknowledgements</a>: Whom to blame.
<li><a href="#History">History</a>: Rough outline of development history.
</li></ul>
<p>Appendices
</p>
<ul class="menu">
<li><a href="#PR29-discussion">PR29 discussion</a>: Implementation aspects of the PR29 flaw.
<li><a href="#On-Label-Separators">On Label Separators</a>: Discussions of a flaw in the IDNA spec.
<li><a href="#Copying-Information">Copying Information</a>: License text covering the Libidn library.
</li></ul>
<p>Indices
</p>
<ul class="menu">
<li><a href="#Function-and-Variable-Index">Function and Variable Index</a>
<li><a href="#Concept-Index">Concept Index</a>
</ul>
<div class="node">
<a name="Introduction"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Preparation">Preparation</a>,
Previous: <a rel="previous" accesskey="p" href="#Top">Top</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">1 Introduction</h2>
<p>GNU Libidn is a fully documented implementation of the Stringprep,
Punycode and IDNA specifications. Libidn's purpose is to encode and
decode internationalized domain names. The native C, C# and Java
libraries are available under the GNU Lesser General Public License
version 2.1 or later (see <a href="#GNU-LGPL">GNU LGPL</a>).
<p>The library contains a generic Stringprep implementation. Profiles
for Nameprep, iSCSI, SASL, XMPP and Kerberos V5 are included.
Punycode and ASCII Compatible Encoding (ACE) via IDNA are supported.
A mechanism to define Top-Level Domain (TLD) specific validation
tables, and to compare strings against those tables, is included.
Default tables for some TLDs are also included.
<p>The Stringprep API consists of two main functions, one for converting
data from the system's native representation into UTF-8, and one
function to perform the Stringprep processing. Adding a new
Stringprep profile for your application within the API is
straightforward. The Punycode API consists of one encoding function
and one decoding function. The IDNA API consists of the ToASCII and
ToUnicode functions, as well as an high-level interface for converting
entire domain names to and from the ACE encoded form. The TLD API
consists of one set of functions to extract the TLD name from a domain
string, one set of functions to locate the proper TLD table to use
based on the TLD name, and core functions to validate a string against
a TLD table, and some utility wrappers to perform all the steps in one
call.
<p>The library is used by, e.g., GNU SASL and Shishi to process user
names and passwords. Libidn can be built into GNU Libc to enable a
new system-wide getaddrinfo flag for IDN processing.
<p>Libidn is developed for the GNU/Linux system, but runs on over 20 Unix
platforms (including Solaris, IRIX, AIX, and Tru64) and Windows. The
library is written in C and (parts of) the API is also accessible from
C++, Emacs Lisp, Python and Java. A native Java and C# port is
included.
<p>Also included is a command line tool, several self tests, code
examples, and more, all licensed under the GNU General Public License
version 3.0 or later (see <a href="#GNU-GPL">GNU GPL</a>).
<ul class="menu">
<li><a accesskey="1" href="#Getting-Started">Getting Started</a>
<li><a accesskey="2" href="#Features">Features</a>
<li><a accesskey="3" href="#Library-Overview">Library Overview</a>
<li><a accesskey="4" href="#Supported-Platforms">Supported Platforms</a>
<li><a accesskey="5" href="#Getting-help">Getting help</a>
<li><a accesskey="6" href="#Commercial-Support">Commercial Support</a>
<li><a accesskey="7" href="#Downloading-and-Installing">Downloading and Installing</a>
<li><a accesskey="8" href="#Bug-Reports">Bug Reports</a>
<li><a accesskey="9" href="#Contributing">Contributing</a>
</ul>
<div class="node">
<a name="Getting-Started"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Features">Features</a>,
Up: <a rel="up" accesskey="u" href="#Introduction">Introduction</a>
</div>
<h3 class="section">1.1 Getting Started</h3>
<p>This manual documents the library programming interface. All
functions and data types provided by the library are explained.
Included are also examples, and documentation for the command line
tool <samp><span class="file">idn</span></samp> that provide a quick interface to the library. The
Emacs Lisp bindings for the library is also discussed.
<p>The reader is assumed to possess basic familiarity with
internationalization concepts and network programming in C or C++.
<p>This manual can be used in several ways. If read from the beginning
to the end, it gives a good introduction into the library and how it
can be used in an application. Forward references are included where
necessary. Later on, the manual can be used as a reference manual to
get just the information needed about any particular interface of the
library. Experienced programmers might want to start looking at the
examples at the end of the manual (see <a href="#Examples">Examples</a>), and then only
read up those parts of the interface which are unclear.
<div class="node">
<a name="Features"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Library-Overview">Library Overview</a>,
Previous: <a rel="previous" accesskey="p" href="#Getting-Started">Getting Started</a>,
Up: <a rel="up" accesskey="u" href="#Introduction">Introduction</a>
</div>
<h3 class="section">1.2 Features</h3>
<p>This library might have a couple of advantages over other libraries
doing a similar job.
<dl>
<dt>It's Free Software<dd>Anybody can use, modify, and redistribute it under the terms of the
GNU Lesser General Public License version 2.1 or later (see <a href="#GNU-LGPL">GNU LGPL</a>).
<br><dt>It's thread-safe<dd>No global state is kept in the library. All functions are reentrant.
<br><dt>It's portable<dd>The code is intended to be written in pure ANSI C89. It has been
tested on many Unix like operating systems, and Windows.
<br><dt>It's modularized<dd>The library is composed of several modules, and the only interaction
between modules is through each modules' public API. If you only need
one piece of functionality, it is possible to take the files you need
and incorporate them into your own project.
<br><dt>It's not bloated<dd>The design of the library is based on the smallest API necessary to
implement the basic functionality. It has been carefully extended
with a small number of high-level wrappers to make it comfortable to
use the library. However, it does not implement additional
functionality just for the sake of completeness.
<br><dt>It's documented<dd>Sadly, not all software comes with documentation these days. This one
does.
</dl>
<div class="node">
<a name="Library-Overview"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Supported-Platforms">Supported Platforms</a>,
Previous: <a rel="previous" accesskey="p" href="#Features">Features</a>,
Up: <a rel="up" accesskey="u" href="#Introduction">Introduction</a>
</div>
<h3 class="section">1.3 Library Overview</h3>
<p>The following illustration show the components that make up Libidn,
and how your application relates to the library. In the illustration,
various components are shown as boxes. You see the generic StringPrep
component, the various StringPrep profiles including Nameprep, the
Punycode component, the IDNA component, and the TLD component. The
arrows indicate aggregation, e.g., IDNA uses Punycode and Nameprep,
and in turn Nameprep uses the generic StringPrep interface. The
interfaces to all components are available for applications, no
component within the library is hidden from the application.
<div class="block-image"><img src="libidn-components.png" alt="libidn-components.png"></div>
<div class="node">
<a name="Supported-Platforms"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Getting-help">Getting help</a>,
Previous: <a rel="previous" accesskey="p" href="#Library-Overview">Library Overview</a>,
Up: <a rel="up" accesskey="u" href="#Introduction">Introduction</a>
</div>
<h3 class="section">1.4 Supported Platforms</h3>
<p>Libidn has at some point in time been tested on the following
platforms. Online build reports for each platforms and Libidn version
is available at <a href="http://autobuild.josefsson.org/libidn/">http://autobuild.josefsson.org/libidn/</a>.
<ol type=1 start=1>
<li>Debian GNU/Linux 3.0 (Woody)
<a name="index-Debian-1"></a>
GCC 2.95.4 and GNU Make. This is the main development platform.
<code>alphaev67-unknown-linux-gnu</code>, <code>alphaev6-unknown-linux-gnu</code>,
<code>arm-unknown-linux-gnu</code>, <code>armv4l-unknown-linux-gnu</code>,
<code>hppa-unknown-linux-gnu</code>, <code>hppa64-unknown-linux-gnu</code>,
<code>i686-pc-linux-gnu</code>, <code>ia64-unknown-linux-gnu</code>,
<code>m68k-unknown-linux-gnu</code>, <code>mips-unknown-linux-gnu</code>,
<code>mipsel-unknown-linux-gnu</code>, <code>powerpc-unknown-linux-gnu</code>,
<code>s390-ibm-linux-gnu</code>, <code>sparc-unknown-linux-gnu</code>,
<code>sparc64-unknown-linux-gnu</code>.
<li>Debian GNU/Linux 2.1
<a name="index-Debian-2"></a>
GCC 2.95.1 and GNU Make. <code>armv4l-unknown-linux-gnu</code>.
<li>Tru64 UNIX
<a name="index-Tru64-3"></a>
Tru64 UNIX C compiler and Tru64 Make. <code>alphaev67-dec-osf5.1</code>,
<code>alphaev68-dec-osf5.1</code>.
<li>SuSE Linux 7.1
<a name="index-SuSE-4"></a>
GCC 2.96 and GNU Make. <code>alphaev6-unknown-linux-gnu</code>,
<code>alphaev67-unknown-linux-gnu</code>.
<li>SuSE Linux 7.2a
<a name="index-SuSE-Linux-5"></a>
GCC 3.0 and GNU Make. <code>ia64-unknown-linux-gnu</code>.
<li>SuSE Linux
<a name="index-SuSE-Linux-6"></a>
GCC 3.2.2 and GNU Make. <code>x86_64-unknown-linux-gnu</code> (AMD64
Opteron “Melody”).
<li>SuSE Enterprise Server 9 on IBM OpenPower 720
<a name="index-SuSE-Linux-7"></a><a name="index-OpenPower-720-8"></a>
GCC 3.3.3 and GNU Make. <code>powerpc64-unknown-linux-gnu</code>.
<li>RedHat Linux 7.2
<a name="index-RedHat-9"></a>
GCC 2.96 and GNU Make. <code>alphaev6-unknown-linux-gnu</code>,
<code>alphaev67-unknown-linux-gnu</code>, <code>ia64-unknown-linux-gnu</code>.
<li>RedHat Linux 8.0
<a name="index-RedHat-10"></a>
GCC 3.2 and GNU Make. <code>i686-pc-linux-gnu</code>.
<li>RedHat Advanced Server 2.1
<a name="index-RedHat-Advanced-Server-11"></a>
GCC 2.96 and GNU Make. <code>i686-pc-linux-gnu</code>.
<li>Slackware Linux 8.0.01
<a name="index-RedHat-12"></a>
GCC 2.95.3 and GNU Make. <code>i686-pc-linux-gnu</code>.
<li>Mandrake Linux 9.0
<a name="index-Mandrake-13"></a>
GCC 3.2 and GNU Make. <code>i686-pc-linux-gnu</code>.
<li>IRIX 6.5
<a name="index-IRIX-14"></a>
MIPS C compiler, IRIX Make. <code>mips-sgi-irix6.5</code>.
<li>AIX 4.3.2
<a name="index-AIX-15"></a>
IBM C for AIX compiler, AIX Make. <code>rs6000-ibm-aix4.3.2.0</code>.
<li>Microsoft Windows 2000 (Cygwin)
<a name="index-Windows-16"></a>
GCC 3.2, GNU make. <code>i686-pc-cygwin</code>.
<li>HP-UX 11
<a name="index-HP_002dUX-17"></a>
HP-UX C compiler and HP Make. <code>ia64-hp-hpux11.22</code>,
<code>hppa2.0w-hp-hpux11.11</code>.
<li>SUN Solaris 2.7
<a name="index-Solaris-18"></a>
GCC 3.0.4 and GNU Make. <code>sparc-sun-solaris2.7</code>.
<li>SUN Solaris 2.8
<a name="index-Solaris-19"></a>
Sun WorkShop Compiler C 6.0 and SUN Make. <code>sparc-sun-solaris2.8</code>.
<li>SUN Solaris 2.9
<a name="index-Solaris-20"></a>
Sun Forte Developer 7 C compiler and GNU
Make. <code>sparc-sun-solaris2.9</code>.
<li>NetBSD 1.6
<a name="index-NetBSD-21"></a>
GCC 2.95.3 and GNU Make. <code>alpha-unknown-netbsd1.6</code>,
<code>i386-unknown-netbsdelf1.6</code>.
<li>OpenBSD 3.1 and 3.2
<a name="index-OpenBSD-22"></a>
GCC 2.95.3 and GNU Make. <code>alpha-unknown-openbsd3.1</code>,
<code>i386-unknown-openbsd3.1</code>.
<li>FreeBSD 4.7 and 4.8
<a name="index-FreeBSD-23"></a>
GCC 2.95.4 and GNU Make. <code>alpha-unknown-freebsd4.7</code>,
<code>alpha-unknown-freebsd4.8</code>, <code>i386-unknown-freebsd4.7</code>,
<code>i386-unknown-freebsd4.8</code>.
<li>MacOS X 10.2 Server Edition
<a name="index-MacOS-X-24"></a>
GCC 3.1 and GNU Make. <code>powerpc-apple-darwin6.5</code>.
<li>MacOS X 10.4 “Tiger” with Xcode 2.0
<a name="index-MacOS-X-25"></a>
GCC 4.0 and GNU Make. <code>powerpc-apple-darwin8.0</code>.
<li>Cross compiled to uClinux/uClibc on Motorola Coldfire
<a name="index-Motorola-Coldfire-26"></a><a name="index-uClinux-27"></a><a name="index-uClibc-28"></a>
GCC 3.4 and GNU Make <code>m68k-uclinux-elf</code>.
<li>Cross compiled to ARM using Glibc
<a name="index-ARM-29"></a>
GCC 2.95 and GNU Make <code>arm-linux</code>.
<li>Cross compiled to Mingw32.
<a name="index-Windows-30"></a><a name="index-Microsoft-31"></a><a name="index-mingw32-32"></a>
GCC 3.4.4 and GNU Make <code>i586-mingw32msvc</code>.
<li>OS/2
<a name="index-OS_002f2-33"></a><a name="index-IBM-34"></a>
GCC.
</ol>
<p>If you use Libidn on, or port Libidn to, a new platform please report
it to the author.
<div class="node">
<a name="Getting-help"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Commercial-Support">Commercial Support</a>,
Previous: <a rel="previous" accesskey="p" href="#Supported-Platforms">Supported Platforms</a>,
Up: <a rel="up" accesskey="u" href="#Introduction">Introduction</a>
</div>
<h3 class="section">1.5 Getting help</h3>
<p>A mailing list where users of Libidn may help each other exists, and
you can reach it by sending e-mail to <a href="mailto:help-libidn@gnu.org">help-libidn@gnu.org</a>.
Archives of the mailing list discussions, and an interface to manage
subscriptions, is available through the World Wide Web at
<a href="http://lists.gnu.org/mailman/listinfo/help-libidn">http://lists.gnu.org/mailman/listinfo/help-libidn</a>.
<div class="node">
<a name="Commercial-Support"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Downloading-and-Installing">Downloading and Installing</a>,
Previous: <a rel="previous" accesskey="p" href="#Getting-help">Getting help</a>,
Up: <a rel="up" accesskey="u" href="#Introduction">Introduction</a>
</div>
<h3 class="section">1.6 Commercial Support</h3>
<p>Commercial support is available for users of GNU Libidn. The kind of
support that can be purchased may include:
<ul>
<li>Implement new features.
Such as country code specific profiling to support a restricted subset
of Unicode.
<li>Port Libidn to new platforms.
This could include porting Libidn to an embedded platforms that may
need memory or size optimization.
<li>Integrating IDN support in your existing project.
<li>System design of components related to IDN.
</ul>
<p>If you are interested, please write to:
<pre class="verbatim">Simon Josefsson Datakonsult
Hagagatan 24
113 47 Stockholm
Sweden
E-mail: simon@josefsson.org
</pre>
<p>If your company provides support related to GNU Libidn and would like
to be mentioned here, contact the author (see <a href="#Bug-Reports">Bug Reports</a>).
<div class="node">
<a name="Downloading-and-Installing"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Bug-Reports">Bug Reports</a>,
Previous: <a rel="previous" accesskey="p" href="#Commercial-Support">Commercial Support</a>,
Up: <a rel="up" accesskey="u" href="#Introduction">Introduction</a>
</div>
<h3 class="section">1.7 Downloading and Installing</h3>
<p><a name="index-Installation-35"></a><a name="index-Download-36"></a>
The package can be downloaded from several places, including:
<p><a href="ftp://alpha.gnu.org/pub/gnu/libidn/">ftp://alpha.gnu.org/pub/gnu/libidn/</a>
<p>The latest version is stored in a file, e.g.,
‘<samp><span class="samp">libidn-1.18.tar.gz</span></samp>’ where the ‘<samp><span class="samp">1.18</span></samp>’
value is the highest version number in the directory.
<p>The package is then extracted, configured and built like many other
packages that use Autoconf. For detailed information on configuring
and building it, refer to the <samp><span class="file">INSTALL</span></samp> file that is part of the
distribution archive.
<p>Here is an example terminal session that download, configure, build
and install the package. You will need a few basic tools, such as
‘<samp><span class="samp">sh</span></samp>’, ‘<samp><span class="samp">make</span></samp>’ and ‘<samp><span class="samp">cc</span></samp>’.
<pre class="example"> $ wget -q ftp://alpha.gnu.org/pub/gnu/libidn/libidn-1.18.tar.gz
$ tar xfz libidn-1.18.tar.gz
$ cd libidn-1.18/
$ ./configure
...
$ make
...
$ make install
...
</pre>
<p>After that Libidn should be properly installed and ready for use.
<p>A few <code>configure</code> options may be relevant, summarized in the
table.
<dl>
<dt><code>--enable-java</code><dd>Build the Java port into a *.JAR file. See <a href="#Java-API">Java API</a>, for more
information.
<br><dt><code>--disable-tld</code><dd>Disable the TLD module. This would typically only be useful if you
are building on a memory restricted platforms. See <a href="#TLD-Functions">TLD Functions</a>,
for more information.
<br><dt><code>--enable-csharp[=IMPL]</code><dd>Build the <code>C#</code> port into a <code>*.DLL</code> file. See <a href="#C_0023-API">C# API</a>, for
more information. Here, <code>IMPL</code> is <code>pnet</code> or <code>mono</code>,
indicating whether the PNET <samp><span class="command">cscc</span></samp> compiler or the Mono
<samp><span class="command">mcs</span></samp> compiler should be used, respectively.
</dl>
<p>For the complete list, refer to the output from <code>configure
--help</code>.
<ul class="menu">
<li><a accesskey="1" href="#Installing-under-Windows">Installing under Windows</a>: Windows specific build instructions.
</ul>
<div class="node">
<a name="Installing-under-Windows"></a>
<p><hr>
Up: <a rel="up" accesskey="u" href="#Downloading-and-Installing">Downloading and Installing</a>
</div>
<h4 class="subsection">1.7.1 Installing under Windows</h4>
<p>There are two ways to build Libidn on Windows: via MinGW or via Visual
Studio.
<p>With MinGW, you can build a Libidn DLL and use it from other
applications. After installing MinGW (<a href="http://mingw.org/">http://mingw.org/</a>) follow
the generic installation instructions (see <a href="#Downloading-and-Installing">Downloading and Installing</a>). The DLL is installed by default.
<p>For information on how to use the DLL in other applications, see:
<a href="http://www.mingw.org/mingwfaq.shtml#faq-msvcdll">http://www.mingw.org/mingwfaq.shtml#faq-msvcdll</a>.
<p>You can build Libidn as a native Visual Studio C++ project. This
allows you to build the code for other platforms that VS supports,
such as Windows Mobile. You need Visual Studio 2005 or later.
<p>First download and unpack the archive as described in the generic
installation instructions (see <a href="#Downloading-and-Installing">Downloading and Installing</a>). Don't
run <code>./configure</code>. Instead, start Visual Studio and open the
project file <samp><span class="file">win32/libidn.sln</span></samp> inside the Libidn directory. You
should be able to build the project using Build Project.
<p>Output libraries will be written into the <code>win32/lib</code> (or
<code>win32/lib/debug</code> for Debug versions) folder.
<p>When working with Windows you may want to look into the special memory
handling functions that may be needed (see <a href="#Memory-handling-under-Windows">Memory handling under Windows</a>).
<div class="node">
<a name="Bug-Reports"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Contributing">Contributing</a>,
Previous: <a rel="previous" accesskey="p" href="#Downloading-and-Installing">Downloading and Installing</a>,
Up: <a rel="up" accesskey="u" href="#Introduction">Introduction</a>
</div>
<h3 class="section">1.8 Bug Reports</h3>
<p><a name="index-Reporting-Bugs-37"></a>
If you think you have found a bug in Libidn, please investigate it and
report it.
<ul>
<li>Please make sure that the bug is really in Libidn, and
preferably also check that it hasn't already been fixed in the latest
version.
<li>You have to send us a test case that makes it possible for us to
reproduce the bug.
<li>You also have to explain what is wrong; if you get a crash, or
if the results printed are not good and in that case, in what way.
Make sure that the bug report includes all information you would need
to fix this kind of bug for someone else.
</ul>
<p>Please make an effort to produce a self-contained report, with
something definite that can be tested or debugged. Vague queries or
piecemeal messages are difficult to act on and don't help the
development effort.
<p>If your bug report is good, we will do our best to help you to get a
corrected version of the software; if the bug report is poor, we won't
do anything about it (apart from asking you to send better bug
reports).
<p>If you think something in this manual is unclear, or downright
incorrect, or if the language needs to be improved, please also send a
note.
<p>Send your bug report to:
<div align="center">‘<samp><span class="samp">bug-libidn@gnu.org</span></samp>’</div>
<div class="node">
<a name="Contributing"></a>
<p><hr>
Previous: <a rel="previous" accesskey="p" href="#Bug-Reports">Bug Reports</a>,
Up: <a rel="up" accesskey="u" href="#Introduction">Introduction</a>
</div>
<h3 class="section">1.9 Contributing</h3>
<p><a name="index-Contributing-38"></a><a name="index-Hacking-39"></a>
If you want to submit a patch for inclusion – from solve a typo you
discovered, up to adding support for a new feature – you should
submit it as a bug report (see <a href="#Bug-Reports">Bug Reports</a>). There are some
things that you can do to increase the chances for it to be included
in the official package.
<p>Unless your patch is very small (say, under 10 lines) we require that
you assign the copyright of your work to the Free Software Foundation.
This is to protect the freedom of the project. If you have not
already signed papers, we will send you the necessary information when
you submit your contribution.
<p>For contributions that doesn't consist of actual programming code, the
only guidelines are common sense. Use it.
<p>For code contributions, a number of style guides will help you:
<ul>
<li>Coding Style.
Follow the GNU Standards document (see <a href="standards.html#Top">GNU Coding Standards</a>).
<p>If you normally code using another coding standard, there is no
problem, but you should use ‘<samp><span class="samp">indent</span></samp>’ to reformat the code
(see <a href="indent.html#Top">GNU Indent</a>) before submitting your work.
<li>Use the unified diff format ‘<samp><span class="samp">diff -u</span></samp>’.
<li>Return errors.
No reason whatsoever should abort the execution of the library. Even
memory allocation errors, e.g. when malloc return NULL, should work
although result in an error code.
<li>Design with thread safety in mind.
Don't use global variables and the like.
<li>Avoid using the C math library.
It causes problems for embedded implementations, and in most
situations it is very easy to avoid using it.
<li>Document your functions.
Use comments before each function headers, that, if properly
formatted, are extracted into GTK-DOC web pages. Don't forget to
update the Texinfo manual as well.
<li>Supply a ChangeLog and NEWS entries, where appropriate.
</ul>
<!-- ********************************************************** -->
<!-- ******************* Preparation ************************ -->
<!-- ********************************************************** -->
<div class="node">
<a name="Preparation"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Utility-Functions">Utility Functions</a>,
Previous: <a rel="previous" accesskey="p" href="#Introduction">Introduction</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">2 Preparation</h2>
<p>To use `Libidn', you have to perform some changes to your sources and
the build system. The necessary changes are small and explained in
the following sections. At the end of this chapter, it is described
how the library is initialized, and how the requirements of the
library are verified.
<p>A faster way to find out how to adapt your application for use with
`Libidn' may be to look at the examples at the end of this manual
(see <a href="#Examples">Examples</a>).
<ul class="menu">
<li><a accesskey="1" href="#Header">Header</a>
<li><a accesskey="2" href="#Initialization">Initialization</a>
<li><a accesskey="3" href="#Version-Check">Version Check</a>
<li><a accesskey="4" href="#Building-the-source">Building the source</a>
<li><a accesskey="5" href="#Autoconf-tests">Autoconf tests</a>
<li><a accesskey="6" href="#Memory-handling-under-Windows">Memory handling under Windows</a>
</ul>
<div class="node">
<a name="Header"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Initialization">Initialization</a>,
Up: <a rel="up" accesskey="u" href="#Preparation">Preparation</a>
</div>
<h3 class="section">2.1 Header</h3>
<p>The library contains a few independent parts, and each part export the
interfaces (data types and functions) in a header file. You must
include the appropriate header files in all programs using the
library, either directly or through some other header file, like this:
<pre class="example"> #include <stringprep.h>
</pre>
<p>The header files and the functions they define are categorized as
follows:
<dl>
<dt>stringprep.h<dd>
The low-level stringprep API entry point. For IDN applications, this
is usually invoked via IDNA. Some applications, specifically non-IDN
ones, may want to prepare strings directly though, and should include
this header file.
<p>The name space of the stringprep part of Libidn is <code>stringprep*</code>
for function names, <code>Stringprep*</code> for data types and
<code>STRINGPREP_*</code> for other symbols. In addition,
<code>_stringprep*</code> is reserved for internal use and should never be
used by applications.
<br><dt>punycode.h<dd>
The entry point to Punycode encoding and decoding functions. Normally
punycode is used via the idna.h interface, but some application may
want to perform raw punycode operations.
<p>The name space of the punycode part of Libidn is <code>punycode_*</code> for
function names, <code>Punycode*</code> for data types and <code>PUNYCODE_*</code>
for other symbols. In addition, <code>_punycode*</code> is reserved for
internal use and should never be used by applications.
<br><dt>idna.h<dd>
The entry point to the IDNA functions. This is the normal entry point
for applications that need IDN functionality.
<p>The name space of the IDNA part of Libidn is <code>idna_*</code> for
function names, <code>Idna*</code> for data types and <code>IDNA_*</code> for
other symbols. In addition, <code>_idna*</code> is reserved for internal
use and should never be used by applications.
<br><dt>tld.h<dd>
The entry point to the TLD functions. Normal applications are not
expected to need this functionality, but it is present for
applications that are used by TLDs to validate customer input.
<p>The name space of the TLD part of Libidn is <code>tld_*</code> for function
names, <code>Tld_*</code> for data types and <code>TLD_*</code> for other symbols.
In addition, <code>_tld*</code> is reserved for internal use and should
never be used by applications.
<br><dt>pr29.h<dd>
The entry point to the PR29 functions. These functions are used to
detect “problem sequences” (see <a href="#PR29-Functions">PR29 Functions</a>), mostly for use
in security critical applications.
<p>The name space of the PR29 part of Libidn is <code>pr29_*</code> for
function names, <code>Pr29_*</code> for data types and <code>PR29_*</code> for
other symbols. In addition, <code>_pr29*</code> is reserved for internal
use and should never be used by applications.
<br><dt>idn-free.h<dd>
The entry point to the Windows memory de-allocation function
(see <a href="#Memory-handling-under-Windows">Memory handling under Windows</a>). It contains only one
function <code>idn_free</code>.
</dl>
<p>All header files defined and use the symbol <code>IDNAPI</code> to decorate
the API functions.
<div class="node">
<a name="Initialization"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Version-Check">Version Check</a>,
Previous: <a rel="previous" accesskey="p" href="#Header">Header</a>,
Up: <a rel="up" accesskey="u" href="#Preparation">Preparation</a>
</div>
<h3 class="section">2.2 Initialization</h3>
<p>Libidn is stateless and does not need any initialization.
<div class="node">
<a name="Version-Check"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Building-the-source">Building the source</a>,
Previous: <a rel="previous" accesskey="p" href="#Initialization">Initialization</a>,
Up: <a rel="up" accesskey="u" href="#Preparation">Preparation</a>
</div>
<h3 class="section">2.3 Version Check</h3>
<p>It is often desirable to check that the version of `Libidn' used is
indeed one which fits all requirements. Even with binary
compatibility new features may have been introduced but due to problem
with the dynamic linker an old version is actually used. So you may
want to check that the version is okay right after program startup.
<h4 class="subheading">stringprep_check_version</h4>
<p><a name="stringprep_005fcheck_005fversion"></a>
<div class="defun">
— Function: const char * <b>stringprep_check_version</b> (<var>const char * req_version</var>)<var><a name="index-stringprep_005fcheck_005fversion-40"></a></var><br>
<blockquote><p><var>req_version</var>: Required version number, or NULL.
<p>Check that the version of the library is at minimum the requested one
and return the version string; return NULL if the condition is not
satisfied. If a NULL is passed to this function, no check is done,
but the version string is simply returned.
<p>See <code>STRINGPREP_VERSION</code> for a suitable <code>req_version</code> string.
<p><strong>Return value:</strong> Version string of run-time library, or NULL if the
run-time library does not meet the required version number.
</p></blockquote></div>
<p>The normal way to use the function is to put something similar to the
following first in your <code>main</code>:
<pre class="example"> if (!stringprep_check_version (STRINGPREP_VERSION))
{
printf ("stringprep_check_version() failed:\n"
"Header file incompatible with shared library.\n");
exit(EXIT_FAILURE);
}
</pre>
<div class="node">
<a name="Building-the-source"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Autoconf-tests">Autoconf tests</a>,
Previous: <a rel="previous" accesskey="p" href="#Version-Check">Version Check</a>,
Up: <a rel="up" accesskey="u" href="#Preparation">Preparation</a>
</div>
<h3 class="section">2.4 Building the source</h3>
<p><a name="index-Compiling-your-application-41"></a>
If you want to compile a source file including e.g. the `idna.h' header
file, you must make sure that the compiler can find it in the
directory hierarchy. This is accomplished by adding the path to the
directory in which the header file is located to the compilers include
file search path (via the <samp><span class="option">-I</span></samp> option).
<p>However, the path to the include file is determined at the time the
source is configured. To solve this problem, `Libidn' uses the
external package <samp><span class="command">pkg-config</span></samp> that knows the path to the
include file and other configuration options. The options that need
to be added to the compiler invocation at compile time are output by
the <samp><span class="option">--cflags</span></samp> option to <samp><span class="command">pkg-config libidn</span></samp>. The
following example shows how it can be used at the command line:
<pre class="example"> gcc -c foo.c `pkg-config libidn --cflags`
</pre>
<p>Adding the output of ‘<samp><span class="samp">pkg-config libidn --cflags</span></samp>’ to the
compilers command line will ensure that the compiler can find e.g. the
idna.h header file.
<p>A similar problem occurs when linking the program with the library.
Again, the compiler has to find the library files. For this to work,
the path to the library files has to be added to the library search
path (via the <samp><span class="option">-L</span></samp> option). For this, the option
<samp><span class="option">--libs</span></samp> to <samp><span class="command">pkg-config libidn</span></samp> can be used. For
convenience, this option also outputs all other options that are
required to link the program with the `libidn' libarary. The example
shows how to link <samp><span class="file">foo.o</span></samp> with the `libidn' library to a program
<samp><span class="command">foo</span></samp>.
<pre class="example"> gcc -o foo foo.o `pkg-config libidn --libs`
</pre>
<p>Of course you can also combine both examples to a single command by
specifying both options to <samp><span class="command">pkg-config</span></samp>:
<pre class="example"> gcc -o foo foo.c `pkg-config libidn --cflags --libs`
</pre>
<div class="node">
<a name="Autoconf-tests"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Memory-handling-under-Windows">Memory handling under Windows</a>,
Previous: <a rel="previous" accesskey="p" href="#Building-the-source">Building the source</a>,
Up: <a rel="up" accesskey="u" href="#Preparation">Preparation</a>
</div>
<h3 class="section">2.5 Autoconf tests</h3>
<p><a name="index-Autoconf-tests-42"></a><a name="index-Configure-tests-43"></a>
If your project uses Autoconf (see <a href="autoconf.html#Top">GNU Autoconf</a>)
to check for installed libraries, you might find the following snippet
illustrative. It add a new <samp><span class="file">configure</span></samp> parameter
<code>--with-libidn</code>, and check for <samp><span class="file">idna.h</span></samp> and ‘<samp><span class="samp">-lidn</span></samp>’
(possibly below the directory specified as the optional argument to
<code>--with-libidn</code>), and define the <acronym>CPP</acronym> symbol
<code>LIBIDN</code> if the library is found. The default behaviour is to
search for the library and enable the functionality (that is, define
the symbol) when the library is found, but if you wish to make the
default behaviour of your package be that Libidn is not used (even if
it is installed on the system), change ‘<samp><span class="samp">libidn=yes</span></samp>’ to
‘<samp><span class="samp">libidn=no</span></samp>’ on the third line.
<pre class="example"> AC_ARG_WITH(libidn, AC_HELP_STRING([--with-libidn=[DIR]],
[Support IDN (needs GNU Libidn)]),
libidn=$withval, libidn=yes)
if test "$libidn" != "no"; then
if test "$libidn" != "yes"; then
LDFLAGS="${LDFLAGS} -L$libidn/lib"
CPPFLAGS="${CPPFLAGS} -I$libidn/include"
fi
AC_CHECK_HEADER(idna.h,
AC_CHECK_LIB(idn, stringprep_check_version,
[libidn=yes LIBS="${LIBS} -lidn"], libidn=no),
libidn=no)
fi
if test "$libidn" != "no" ; then
AC_DEFINE(LIBIDN, 1, [Define to 1 if you want IDN support.])
else
AC_MSG_WARN([Libidn not found])
fi
AC_MSG_CHECKING([if Libidn should be used])
AC_MSG_RESULT($libidn)
</pre>
<p>If you require that your users have installed <code>pkg-config</code> (which
I cannot recommend generally), the above can be done more easily as
follows.
<pre class="example"> AC_ARG_WITH(libidn, AC_HELP_STRING([--with-libidn=[DIR]],
[Support IDN (needs GNU Libidn)]),
libidn=$withval, libidn=yes)
if test "$libidn" != "no" ; then
PKG_CHECK_MODULES(LIBIDN, libidn >= 0.0.0, [libidn=yes], [libidn=no])
if test "$libidn" != "yes" ; then
libidn=no
AC_MSG_WARN([Libidn not found])
else
libidn=yes
AC_DEFINE(LIBIDN, 1, [Define to 1 if you want Libidn.])
fi
fi
AC_MSG_CHECKING([if Libidn should be used])
AC_MSG_RESULT($libidn)
</pre>
<div class="node">
<a name="Memory-handling-under-Windows"></a>
<p><hr>
Previous: <a rel="previous" accesskey="p" href="#Autoconf-tests">Autoconf tests</a>,
Up: <a rel="up" accesskey="u" href="#Preparation">Preparation</a>
</div>
<h3 class="section">2.6 Memory handling under Windows</h3>
<p><a name="index-free-44"></a><a name="index-Memory-handling-45"></a><a name="index-de_002dallocation-46"></a><a name="index-heap-memory-47"></a>
Several functions in the library allocates memory. The memory is
expected to be de-allocated using the <code>free</code> function. Under
Windows, it is sometimes necessary to de-allocate memory in the same
module that allocated a memory region. The reason is that different
modules use separate heap memory regions. To solve this problem we
provide a function to de-allocate memory inside the library.
<p>Note that we do not recommend using this interface generally if you do
not care about Windows portability.
<h3 class="section">2.7 Header file <code>idn-free.h</code></h3>
<p>To use the function explained in this chapter, you need to include the
file <samp><span class="file">idn-free.h</span></samp> using:
<pre class="example"> #include <idn-free.h>
</pre>
<h3 class="section">2.8 Memory de-allocation function</h3>
<h4 class="subheading">idn_free</h4>
<p><a name="idn_005ffree"></a>
<div class="defun">
— Function: void <b>idn_free</b> (<var>void * ptr</var>)<var><a name="index-idn_005ffree-48"></a></var><br>
<blockquote><p><var>ptr</var>: memory region to deallocate, or <code>NULL</code>.
<p>Deallocates memory region by calling <code>free()</code>. If <code>ptr</code> is <code>NULL</code> no
operation is performed.
<p>Normally applications de-allocate strings allocated by libidn by
calling <code>free()</code> directly. Under Windows, different parts of the
same application may use different heap memory, and then it is
important to deallocate memory allocated within the same module
that allocated it. This function makes that possible.
</p></blockquote></div>
<!-- ********************************************************** -->
<!-- ******************** Utility Functions ****************** -->
<!-- ********************************************************** -->
<div class="node">
<a name="Utility-Functions"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Stringprep-Functions">Stringprep Functions</a>,
Previous: <a rel="previous" accesskey="p" href="#Preparation">Preparation</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">3 Utility Functions</h2>
<p><a name="index-Utility-Functions-49"></a>
The rest of this library makes extensive use of Unicode characters.
In order to interface this library with the outside world, your
application may need to make various Unicode transformations.
<h3 class="section">3.1 Header file <code>stringprep.h</code></h3>
<p>To use the functions explained in this chapter, you need to include
the file <samp><span class="file">stringprep.h</span></samp> using:
<pre class="example"> #include <stringprep.h>
</pre>
<h3 class="section">3.2 Unicode Encoding Transformation</h3>
<h4 class="subheading">stringprep_unichar_to_utf8</h4>
<p><a name="stringprep_005funichar_005fto_005futf8"></a>
<div class="defun">
— Function: int <b>stringprep_unichar_to_utf8</b> (<var>uint32_t c, char * outbuf</var>)<var><a name="index-stringprep_005funichar_005fto_005futf8-50"></a></var><br>
<blockquote><p><var>c</var>: a ISO10646 character code
<p><var>outbuf</var>: output buffer, must have at least 6 bytes of space.
If <code>NULL</code>, the length will be computed and returned
and nothing will be written to <code>outbuf</code>.
<p>Converts a single character to UTF-8.
<p><strong>Return value:</strong> number of bytes written.
</p></blockquote></div>
<h4 class="subheading">stringprep_utf8_to_unichar</h4>
<p><a name="stringprep_005futf8_005fto_005funichar"></a>
<div class="defun">
— Function: uint32_t <b>stringprep_utf8_to_unichar</b> (<var>const char * p</var>)<var><a name="index-stringprep_005futf8_005fto_005funichar-51"></a></var><br>
<blockquote><p><var>p</var>: a pointer to Unicode character encoded as UTF-8
<p>Converts a sequence of bytes encoded as UTF-8 to a Unicode character.
If <code>p</code> does not point to a valid UTF-8 encoded character, results are
undefined.
<p><strong>Return value:</strong> the resulting character.
</p></blockquote></div>
<h4 class="subheading">stringprep_ucs4_to_utf8</h4>
<p><a name="stringprep_005fucs4_005fto_005futf8"></a>
<div class="defun">
— Function: char * <b>stringprep_ucs4_to_utf8</b> (<var>const uint32_t * str, ssize_t len, size_t * items_read, size_t * items_written</var>)<var><a name="index-stringprep_005fucs4_005fto_005futf8-52"></a></var><br>
<blockquote><p><var>str</var>: a UCS-4 encoded string
<p><var>len</var>: the maximum length of <code>str</code> to use. If <code>len</code> < 0, then
the string is terminated with a 0 character.
<p><var>items_read</var>: location to store number of characters read read, or <code>NULL</code>.
<p><var>items_written</var>: location to store number of bytes written or <code>NULL</code>.
The value here stored does not include the trailing 0
byte.
<p>Convert a string from a 32-bit fixed width representation as UCS-4.
to UTF-8. The result will be terminated with a 0 byte.
<p><strong>Return value:</strong> a pointer to a newly allocated UTF-8 string.
This value must be deallocated by the caller.
If an error occurs, <code>NULL</code> will be returned and <code>error</code>
set.
</p></blockquote></div>
<h4 class="subheading">stringprep_utf8_to_ucs4</h4>
<p><a name="stringprep_005futf8_005fto_005fucs4"></a>
<div class="defun">
— Function: uint32_t * <b>stringprep_utf8_to_ucs4</b> (<var>const char * str, ssize_t len, size_t * items_written</var>)<var><a name="index-stringprep_005futf8_005fto_005fucs4-53"></a></var><br>
<blockquote><p><var>str</var>: a UTF-8 encoded string
<p><var>len</var>: the maximum length of <code>str</code> to use. If <code>len</code> < 0, then
the string is nul-terminated.
<p><var>items_written</var>: location to store the number of characters in the
result, or <code>NULL</code>.
<p>Convert a string from UTF-8 to a 32-bit fixed width
representation as UCS-4, assuming valid UTF-8 input.
This function does no error checking on the input.
<p><strong>Return value:</strong> a pointer to a newly allocated UCS-4 string.
This value must be deallocated by the caller.
</p></blockquote></div>
<h3 class="section">3.3 Unicode Normalization</h3>
<h4 class="subheading">stringprep_ucs4_nfkc_normalize</h4>
<p><a name="stringprep_005fucs4_005fnfkc_005fnormalize"></a>
<div class="defun">
— Function: uint32_t * <b>stringprep_ucs4_nfkc_normalize</b> (<var>uint32_t * str, ssize_t len</var>)<var><a name="index-stringprep_005fucs4_005fnfkc_005fnormalize-54"></a></var><br>
<blockquote><p><var>str</var>: a Unicode string.
<p><var>len</var>: length of <code>str</code> array, or -1 if <code>str</code> is nul-terminated.
<p>Converts UCS4 string into UTF-8 and runs
<code>stringprep_utf8_nfkc_normalize()</code>.
<p><strong>Return value:</strong> a newly allocated Unicode string, that is the NFKC
normalized form of <code>str</code>.
</p></blockquote></div>
<h4 class="subheading">stringprep_utf8_nfkc_normalize</h4>
<p><a name="stringprep_005futf8_005fnfkc_005fnormalize"></a>
<div class="defun">
— Function: char * <b>stringprep_utf8_nfkc_normalize</b> (<var>const char * str, ssize_t len</var>)<var><a name="index-stringprep_005futf8_005fnfkc_005fnormalize-55"></a></var><br>
<blockquote><p><var>str</var>: a UTF-8 encoded string.
<p><var>len</var>: length of <code>str</code>, in bytes, or -1 if <code>str</code> is nul-terminated.
<p>Converts a string into canonical form, standardizing
such issues as whether a character with an accent
is represented as a base character and combining
accent or as a single precomposed character.
<p>The normalization mode is NFKC (ALL COMPOSE). It standardizes
differences that do not affect the text content, such as the
above-mentioned accent representation. It standardizes the
"compatibility" characters in Unicode, such as SUPERSCRIPT THREE to
the standard forms (in this case DIGIT THREE). Formatting
information may be lost but for most text operations such
characters should be considered the same. It returns a result with
composed forms rather than a maximally decomposed form.
<p><strong>Return value:</strong> a newly allocated string, that is the
NFKC normalized form of <code>str</code>.
</p></blockquote></div>
<h3 class="section">3.4 Character Set Conversion</h3>
<h4 class="subheading">stringprep_locale_charset</h4>
<p><a name="stringprep_005flocale_005fcharset"></a>
<div class="defun">
— Function: const char * <b>stringprep_locale_charset</b> (<var> void</var>)<var><a name="index-stringprep_005flocale_005fcharset-56"></a></var><br>
<blockquote>
<p>Find out current locale charset. The function respect the CHARSET
environment variable, but typically uses nl_langinfo(CODESET) when
it is supported. It fall back on "ASCII" if CHARSET isn't set and
nl_langinfo isn't supported or return anything.
<p>Note that this function return the application's locale's preferred
charset (or thread's locale's preffered charset, if your system
support thread-specific locales). It does not return what the
system may be using. Thus, if you receive data from external
sources you cannot in general use this function to guess what
charset it is encoded in. Use stringprep_convert from the external
representation into the charset returned by this function, to have
data in the locale encoding.
<p><strong>Return value:</strong> Return the character set used by the current locale.
It will never return NULL, but use "ASCII" as a fallback.
</p></blockquote></div>
<h4 class="subheading">stringprep_convert</h4>
<p><a name="stringprep_005fconvert"></a>
<div class="defun">
— Function: char * <b>stringprep_convert</b> (<var>const char * str, const char * to_codeset, const char * from_codeset</var>)<var><a name="index-stringprep_005fconvert-57"></a></var><br>
<blockquote><p><var>str</var>: input zero-terminated string.
<p><var>to_codeset</var>: name of destination character set.
<p><var>from_codeset</var>: name of origin character set, as used by <code>str</code>.
<p>Convert the string from one character set to another using the
system's <code>iconv()</code> function.
<p><strong>Return value:</strong> Returns newly allocated zero-terminated string which
is <code>str</code> transcoded into to_codeset.
</p></blockquote></div>
<h4 class="subheading">stringprep_locale_to_utf8</h4>
<p><a name="stringprep_005flocale_005fto_005futf8"></a>
<div class="defun">
— Function: char * <b>stringprep_locale_to_utf8</b> (<var>const char * str</var>)<var><a name="index-stringprep_005flocale_005fto_005futf8-58"></a></var><br>
<blockquote><p><var>str</var>: input zero terminated string.
<p>Convert string encoded in the locale's character set into UTF-8 by
using <code>stringprep_convert()</code>.
<p><strong>Return value:</strong> Returns newly allocated zero-terminated string which
is <code>str</code> transcoded into UTF-8.
</p></blockquote></div>
<h4 class="subheading">stringprep_utf8_to_locale</h4>
<p><a name="stringprep_005futf8_005fto_005flocale"></a>
<div class="defun">
— Function: char * <b>stringprep_utf8_to_locale</b> (<var>const char * str</var>)<var><a name="index-stringprep_005futf8_005fto_005flocale-59"></a></var><br>
<blockquote><p><var>str</var>: input zero terminated string.
<p>Convert string encoded in UTF-8 into the locale's character set by
using <code>stringprep_convert()</code>.
<p><strong>Return value:</strong> Returns newly allocated zero-terminated string which
is <code>str</code> transcoded into the locale's character set.
</p></blockquote></div>
<!-- ********************************************************** -->
<!-- ****************** Stringprep Functions ***************** -->
<!-- ********************************************************** -->
<div class="node">
<a name="Stringprep-Functions"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Punycode-Functions">Punycode Functions</a>,
Previous: <a rel="previous" accesskey="p" href="#Utility-Functions">Utility Functions</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">4 Stringprep Functions</h2>
<p><a name="index-Stringprep-Functions-60"></a>
Stringprep describes a framework for preparing Unicode text strings in
order to increase the likelihood that string input and string
comparison work in ways that make sense for typical users throughout
the world. The stringprep protocol is useful for protocol identifier
values, company and personal names, internationalized domain names,
and other text strings.
<h3 class="section">4.1 Header file <code>stringprep.h</code></h3>
<p>To use the functions explained in this chapter, you need to include
the file <samp><span class="file">stringprep.h</span></samp> using:
<pre class="example"> #include <stringprep.h>
</pre>
<h3 class="section">4.2 Defining A Stringprep Profile</h3>
<p>Further types and structures are defined for applications that want to
specify their own stringprep profile. As these are fairly obscure,
and by necessity tied to the implementation, we do not document them
here. Look into the <samp><span class="file">stringprep.h</span></samp> header file, and the
<samp><span class="file">profiles.c</span></samp> source code for the details.
<h3 class="section">4.3 Control Flags</h3>
<div class="defun">
— Stringprep flags: Stringprep_profile_flags <b>STRINGPREP_NO_NFKC</b><var><a name="index-STRINGPREP_005fNO_005fNFKC-61"></a></var><br>
<blockquote><p>Disable the NFKC normalization, as well as selecting the non-NFKC case
folding tables. Usually the profile specifies BIDI and NFKC settings,
and applications should not override it unless in special situations.
</p></blockquote></div>
<div class="defun">
— Stringprep flags: Stringprep_profile_flags <b>STRINGPREP_NO_BIDI</b><var><a name="index-STRINGPREP_005fNO_005fBIDI-62"></a></var><br>
<blockquote><p>Disable the BIDI step. Usually the profile specifies BIDI and NFKC
settings, and applications should not override it unless in special
situations.
</p></blockquote></div>
<div class="defun">
— Stringprep flags: Stringprep_profile_flags <b>STRINGPREP_NO_UNASSIGNED</b><var><a name="index-STRINGPREP_005fNO_005fUNASSIGNED-63"></a></var><br>
<blockquote><p>Make the library return with an error if string contains unassigned
characters according to profile.
</p></blockquote></div>
<h3 class="section">4.4 Core Functions</h3>
<h4 class="subheading">stringprep_4i</h4>
<p><a name="stringprep_005f4i"></a>
<div class="defun">
— Function: int <b>stringprep_4i</b> (<var>uint32_t * ucs4, size_t * len, size_t maxucs4len, Stringprep_profile_flags flags, const Stringprep_profile * profile</var>)<var><a name="index-stringprep_005f4i-64"></a></var><br>
<blockquote><p><var>ucs4</var>: input/output array with string to prepare.
<p><var>len</var>: on input, length of input array with Unicode code points,
on exit, length of output array with Unicode code points.
<p><var>maxucs4len</var>: maximum length of input/output array.
<p><var>flags</var>: a <code>Stringprep_profile_flags</code> value, or 0.
<p><var>profile</var>: pointer to <code>Stringprep_profile</code> to use.
<p>Prepare the input UCS-4 string according to the stringprep profile,
and write back the result to the input string.
<p>The input is not required to be zero terminated (<code>ucs4</code>[<code>len</code>] = 0).
The output will not be zero terminated unless <code>ucs4</code>[<code>len</code>] = 0.
Instead, see <code>stringprep_4zi()</code> if your input is zero terminated or
if you want the output to be.
<p>Since the stringprep operation can expand the string, <code>maxucs4len</code>
indicate how large the buffer holding the string is. This function
will not read or write to code points outside that size.
<p>The <code>flags</code> are one of <code>Stringprep_profile_flags</code> values, or 0.
<p>The <code>profile</code> contain the <code>Stringprep_profile</code> instructions to
perform. Your application can define new profiles, possibly
re-using the generic stringprep tables that always will be part of
the library, or use one of the currently supported profiles.
<p><strong>Return value:</strong> Returns <code>STRINGPREP_OK</code> iff successful, or an
<code>Stringprep_rc</code> error code.
</p></blockquote></div>
<h4 class="subheading">stringprep_4zi</h4>
<p><a name="stringprep_005f4zi"></a>
<div class="defun">
— Function: int <b>stringprep_4zi</b> (<var>uint32_t * ucs4, size_t maxucs4len, Stringprep_profile_flags flags, const Stringprep_profile * profile</var>)<var><a name="index-stringprep_005f4zi-65"></a></var><br>
<blockquote><p><var>ucs4</var>: input/output array with zero terminated string to prepare.
<p><var>maxucs4len</var>: maximum length of input/output array.
<p><var>flags</var>: a <code>Stringprep_profile_flags</code> value, or 0.
<p><var>profile</var>: pointer to <code>Stringprep_profile</code> to use.
<p>Prepare the input zero terminated UCS-4 string according to the
stringprep profile, and write back the result to the input string.
<p>Since the stringprep operation can expand the string, <code>maxucs4len</code>
indicate how large the buffer holding the string is. This function
will not read or write to code points outside that size.
<p>The <code>flags</code> are one of <code>Stringprep_profile_flags</code> values, or 0.
<p>The <code>profile</code> contain the <code>Stringprep_profile</code> instructions to
perform. Your application can define new profiles, possibly
re-using the generic stringprep tables that always will be part of
the library, or use one of the currently supported profiles.
<p><strong>Return value:</strong> Returns <code>STRINGPREP_OK</code> iff successful, or an
<code>Stringprep_rc</code> error code.
</p></blockquote></div>
<h4 class="subheading">stringprep</h4>
<p><a name="stringprep"></a>
<div class="defun">
— Function: int <b>stringprep</b> (<var>char * in, size_t maxlen, Stringprep_profile_flags flags, const Stringprep_profile * profile</var>)<var><a name="index-stringprep-66"></a></var><br>
<blockquote><p><var>in</var>: input/ouput array with string to prepare.
<p><var>maxlen</var>: maximum length of input/output array.
<p><var>flags</var>: a <code>Stringprep_profile_flags</code> value, or 0.
<p><var>profile</var>: pointer to <code>Stringprep_profile</code> to use.
<p>Prepare the input zero terminated UTF-8 string according to the
stringprep profile, and write back the result to the input string.
<p>Note that you must convert strings entered in the systems locale
into UTF-8 before using this function, see
<code>stringprep_locale_to_utf8()</code>.
<p>Since the stringprep operation can expand the string, <code>maxlen</code>
indicate how large the buffer holding the string is. This function
will not read or write to characters outside that size.
<p>The <code>flags</code> are one of <code>Stringprep_profile_flags</code> values, or 0.
<p>The <code>profile</code> contain the <code>Stringprep_profile</code> instructions to
perform. Your application can define new profiles, possibly
re-using the generic stringprep tables that always will be part of
the library, or use one of the currently supported profiles.
<p><strong>Return value:</strong> Returns <code>STRINGPREP_OK</code> iff successful, or an error code.
</p></blockquote></div>
<h4 class="subheading">stringprep_profile</h4>
<p><a name="stringprep_005fprofile"></a>
<div class="defun">
— Function: int <b>stringprep_profile</b> (<var>const char * in, char ** out, const char * profile, Stringprep_profile_flags flags</var>)<var><a name="index-stringprep_005fprofile-67"></a></var><br>
<blockquote><p><var>in</var>: input array with UTF-8 string to prepare.
<p><var>out</var>: output variable with pointer to newly allocate string.
<p><var>profile</var>: name of stringprep profile to use.
<p><var>flags</var>: a <code>Stringprep_profile_flags</code> value, or 0.
<p>Prepare the input zero terminated UTF-8 string according to the
stringprep profile, and return the result in a newly allocated
variable.
<p>Note that you must convert strings entered in the systems locale
into UTF-8 before using this function, see
<code>stringprep_locale_to_utf8()</code>.
<p>The output <code>out</code> variable must be deallocated by the caller.
<p>The <code>flags</code> are one of <code>Stringprep_profile_flags</code> values, or 0.
<p>The <code>profile</code> specifies the name of the stringprep profile to use.
It must be one of the internally supported stringprep profiles.
<p><strong>Return value:</strong> Returns <code>STRINGPREP_OK</code> iff successful, or an error code.
</p></blockquote></div>
<h3 class="section">4.5 Error Handling</h3>
<h4 class="subheading">stringprep_strerror</h4>
<p><a name="stringprep_005fstrerror"></a>
<div class="defun">
— Function: const char * <b>stringprep_strerror</b> (<var>Stringprep_rc rc</var>)<var><a name="index-stringprep_005fstrerror-68"></a></var><br>
<blockquote><p><var>rc</var>: a <code>Stringprep_rc</code> return code.
<p>Convert a return code integer to a text string. This string can be
used to output a diagnostic message to the user.
<p><strong>STRINGPREP_OK:</strong> Successful operation. This value is guaranteed to
always be zero, the remaining ones are only guaranteed to hold
non-zero values, for logical comparison purposes.
<p><strong>STRINGPREP_CONTAINS_UNASSIGNED:</strong> String contain unassigned Unicode
code points, which is forbidden by the profile.
<p><strong>STRINGPREP_CONTAINS_PROHIBITED:</strong> String contain code points
prohibited by the profile.
<p><strong>STRINGPREP_BIDI_BOTH_L_AND_RAL:</strong> String contain code points with
conflicting bidirection category.
<p><strong>STRINGPREP_BIDI_LEADTRAIL_NOT_RAL:</strong> Leading and trailing character
in string not of proper bidirectional category.
<p><strong>STRINGPREP_BIDI_CONTAINS_PROHIBITED:</strong> Contains prohibited code
points detected by bidirectional code.
<p><strong>STRINGPREP_TOO_SMALL_BUFFER:</strong> Buffer handed to function was too
small. This usually indicate a problem in the calling
application.
<p><strong>STRINGPREP_PROFILE_ERROR:</strong> The stringprep profile was inconsistent.
This usually indicate an internal error in the library.
<p><strong>STRINGPREP_FLAG_ERROR:</strong> The supplied flag conflicted with profile.
This usually indicate a problem in the calling application.
<p><strong>STRINGPREP_UNKNOWN_PROFILE:</strong> The supplied profile name was not
known to the library.
<p><strong>STRINGPREP_NFKC_FAILED:</strong> The Unicode NFKC operation failed. This
usually indicate an internal error in the library.
<p><strong>STRINGPREP_MALLOC_ERROR:</strong> The <code>malloc()</code> was out of memory. This is
usually a fatal error.
<p><strong>Return value:</strong> Returns a pointer to a statically allocated string
containing a description of the error with the return code <code>rc</code>.
</p></blockquote></div>
<h3 class="section">4.6 Stringprep Profile Macros</h3>
<div class="defun">
— Function: int <b>stringprep_nameprep_no_unassigned</b> (<var>char * in, int maxlen</var>)<var><a name="index-stringprep_005fnameprep_005fno_005funassigned-69"></a></var><br>
<blockquote>
<p><var>in</var>: input/ouput array with string to prepare.
<p><var>maxlen</var>: maximum length of input/output array.
<p>Prepare the input UTF-8 string according to the nameprep profile. The
AllowUnassigned flag is false, use <code>stringprep_nameprep</code> for
true AllowUnassigned. Returns 0 iff successful, or an error code.
</p></blockquote></div>
<div class="defun">
— Function: int <b>stringprep_iscsi</b> (<var>char * in, int maxlen</var>)<var><a name="index-stringprep_005fiscsi-70"></a></var><br>
<blockquote>
<p><var>in</var>: input/ouput array with string to prepare.
<p><var>maxlen</var>: maximum length of input/output array.
<p>Prepare the input UTF-8 string according to the draft iSCSI stringprep
profile. Returns 0 iff successful, or an error code.
</p></blockquote></div>
<div class="defun">
— Function: int <b>stringprep_plain</b> (<var>char * in, int maxlen</var>)<var><a name="index-stringprep_005fplain-71"></a></var><br>
<blockquote>
<p><var>in</var>: input/ouput array with string to prepare.
<p><var>maxlen</var>: maximum length of input/output array.
<p>Prepare the input UTF-8 string according to the draft SASL ANONYMOUS
profile. Returns 0 iff successful, or an error code.
</p></blockquote></div>
<div class="defun">
— Function: int <b>stringprep_xmpp_nodeprep</b> (<var>char * in, int maxlen</var>)<var><a name="index-stringprep_005fxmpp_005fnodeprep-72"></a></var><br>
<blockquote>
<p><var>in</var>: input/ouput array with string to prepare.
<p><var>maxlen</var>: maximum length of input/output array.
<p>Prepare the input UTF-8 string according to the draft XMPP node
identifier profile. Returns 0 iff successful, or an error code.
</p></blockquote></div>
<div class="defun">
— Function: int <b>stringprep_xmpp_resourceprep</b> (<var>char * in, int maxlen</var>)<var><a name="index-stringprep_005fxmpp_005fresourceprep-73"></a></var><br>
<blockquote>
<p><var>in</var>: input/ouput array with string to prepare.
<p><var>maxlen</var>: maximum length of input/output array.
<p>Prepare the input UTF-8 string according to the draft XMPP resource
identifier profile. Returns 0 iff successful, or an error code.
</p></blockquote></div>
<!-- ********************************************************** -->
<!-- ******************* Punycode Functions ****************** -->
<!-- ********************************************************** -->
<div class="node">
<a name="Punycode-Functions"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#IDNA-Functions">IDNA Functions</a>,
Previous: <a rel="previous" accesskey="p" href="#Stringprep-Functions">Stringprep Functions</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">5 Punycode Functions</h2>
<p><a name="index-Punycode-Functions-74"></a>
Punycode is a simple and efficient transfer encoding syntax designed
for use with Internationalized Domain Names in Applications. It
uniquely and reversibly transforms a Unicode string into an ASCII
string. ASCII characters in the Unicode string are represented
literally, and non-ASCII characters are represented by ASCII
characters that are allowed in host name labels (letters, digits, and
hyphens). A general algorithm called Bootstring allows a string of
basic code points to uniquely represent any string of code points
drawn from a larger set. Punycode is an instance of Bootstring that
uses particular parameter values, appropriate for IDNA.
<h3 class="section">5.1 Header file <code>punycode.h</code></h3>
<p>To use the functions explained in this chapter, you need to include
the file <samp><span class="file">punycode.h</span></samp> using:
<pre class="example"> #include <punycode.h>
</pre>
<h3 class="section">5.2 Unicode Code Point Data Type</h3>
<p>The punycode function uses a special type to denote Unicode code
points. It is guaranteed to always be a 32 bit unsigned integer.
<div class="defun">
— Punycode Unicode code point: uint32_t <b>punycode_uint</b><var><a name="index-punycode_005fuint-75"></a></var><br>
<blockquote><p>A unsigned integer that hold Unicode code points.
</p></blockquote></div>
<h3 class="section">5.3 Core Functions</h3>
<p>Note that the current implementation will fail if the
<code>input_length</code> exceed 4294967295 (the size of
<code>punycode_uint</code>). This restriction may be removed in the future.
Meanwhile applications are encouraged to not depend on this problem,
and use <code>sizeof</code> to initialize <code>input_length</code> and
<code>output_length</code>.
<p>The functions provided are the following two entry points:
<h4 class="subheading">punycode_encode</h4>
<p><a name="punycode_005fencode"></a>
<div class="defun">
— Function: int <b>punycode_encode</b> (<var>size_t input_length, const punycode_uint </var>[]<var> input, const unsigned char </var>[]<var> case_flags, size_t * output_length, char </var>[]<var> output</var>)<var><a name="index-punycode_005fencode-76"></a></var><br>
<blockquote><p><var>input_length</var>: The number of code points in the <code>input</code> array and
the number of flags in the <code>case_flags</code> array.
<p><var>input</var>: An array of code points. They are presumed to be Unicode
code points, but that is not strictly REQUIRED. The array
contains code points, not code units. UTF-16 uses code units
D800 through DFFF to refer to code points 10000..10FFFF. The
code points D800..DFFF do not occur in any valid Unicode string.
The code points that can occur in Unicode strings (0..D7FF and
E000..10FFFF) are also called Unicode scalar values.
<p><var>case_flags</var>: A <code>NULL</code> pointer or an array of boolean values parallel
to the <code>input</code> array. Nonzero (true, flagged) suggests that the
corresponding Unicode character be forced to uppercase after
being decoded (if possible), and zero (false, unflagged) suggests
that it be forced to lowercase (if possible). ASCII code points
(0..7F) are encoded literally, except that ASCII letters are
forced to uppercase or lowercase according to the corresponding
case flags. If <code>case_flags</code> is a <code>NULL</code> pointer then ASCII letters
are left as they are, and other code points are treated as
unflagged.
<p><var>output_length</var>: The caller passes in the maximum number of ASCII
code points that it can receive. On successful return it will
contain the number of ASCII code points actually output.
<p><var>output</var>: An array of ASCII code points. It is *not*
null-terminated; it will contain zeros if and only if the <code>input</code>
contains zeros. (Of course the caller can leave room for a
terminator and add one if needed.)
<p>Converts a sequence of code points (presumed to be Unicode code
points) to Punycode.
<p><strong>Return value:</strong> The return value can be any of the <code>Punycode_status</code>
values defined above except <code>PUNYCODE_BAD_INPUT</code>. If not
<code>PUNYCODE_SUCCESS</code>, then <code>output_size</code> and <code>output</code> might contain
garbage.
</p></blockquote></div>
<h4 class="subheading">punycode_decode</h4>
<p><a name="punycode_005fdecode"></a>
<div class="defun">
— Function: int <b>punycode_decode</b> (<var>size_t input_length, const char </var>[]<var> input, size_t * output_length, punycode_uint </var>[]<var> output, unsigned char </var>[]<var> case_flags</var>)<var><a name="index-punycode_005fdecode-77"></a></var><br>
<blockquote><p><var>input_length</var>: The number of ASCII code points in the <code>input</code> array.
<p><var>input</var>: An array of ASCII code points (0..7F).
<p><var>output_length</var>: The caller passes in the maximum number of code
points that it can receive into the <code>output</code> array (which is also
the maximum number of flags that it can receive into the
<code>case_flags</code> array, if <code>case_flags</code> is not a <code>NULL</code> pointer). On
successful return it will contain the number of code points
actually output (which is also the number of flags actually
output, if case_flags is not a null pointer). The decoder will
never need to output more code points than the number of ASCII
code points in the input, because of the way the encoding is
defined. The number of code points output cannot exceed the
maximum possible value of a punycode_uint, even if the supplied
<code>output_length</code> is greater than that.
<p><var>output</var>: An array of code points like the input argument of
<code>punycode_encode()</code> (see above).
<p><var>case_flags</var>: A <code>NULL</code> pointer (if the flags are not needed by the
caller) or an array of boolean values parallel to the <code>output</code>
array. Nonzero (true, flagged) suggests that the corresponding
Unicode character be forced to uppercase by the caller (if
possible), and zero (false, unflagged) suggests that it be forced
to lowercase (if possible). ASCII code points (0..7F) are output
already in the proper case, but their flags will be set
appropriately so that applying the flags would be harmless.
<p>Converts Punycode to a sequence of code points (presumed to be
Unicode code points).
<p><strong>Return value:</strong> The return value can be any of the <code>Punycode_status</code>
values defined above. If not <code>PUNYCODE_SUCCESS</code>, then
<code>output_length</code>, <code>output</code>, and <code>case_flags</code> might contain garbage.
</p></blockquote></div>
<h3 class="section">5.4 Error Handling</h3>
<h4 class="subheading">punycode_strerror</h4>
<p><a name="punycode_005fstrerror"></a>
<div class="defun">
— Function: const char * <b>punycode_strerror</b> (<var>Punycode_status rc</var>)<var><a name="index-punycode_005fstrerror-78"></a></var><br>
<blockquote><p><var>rc</var>: an <code>Punycode_status</code> return code.
<p>Convert a return code integer to a text string. This string can be
used to output a diagnostic message to the user.
<p><strong>PUNYCODE_SUCCESS:</strong> Successful operation. This value is guaranteed
to always be zero, the remaining ones are only guaranteed to hold
non-zero values, for logical comparison purposes.
<p><strong>PUNYCODE_BAD_INPUT:</strong> Input is invalid.
<p><strong>PUNYCODE_BIG_OUTPUT:</strong> Output would exceed the space provided.
<p><strong>PUNYCODE_OVERFLOW:</strong> Input needs wider integers to process.
<p><strong>Return value:</strong> Returns a pointer to a statically allocated string
containing a description of the error with the return code <code>rc</code>.
</p></blockquote></div>
<!-- ********************************************************** -->
<!-- ********************* IDNA Functions ********************* -->
<!-- ********************************************************** -->
<div class="node">
<a name="IDNA-Functions"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#TLD-Functions">TLD Functions</a>,
Previous: <a rel="previous" accesskey="p" href="#Punycode-Functions">Punycode Functions</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">6 IDNA Functions</h2>
<p><a name="index-IDNA-Functions-79"></a>
Until now, there has been no standard method for domain names to use
characters outside the ASCII repertoire. The IDNA document defines
internationalized domain names (IDNs) and a mechanism called IDNA for
handling them in a standard fashion. IDNs use characters drawn from a
large repertoire (Unicode), but IDNA allows the non-ASCII characters
to be represented using only the ASCII characters already allowed in
so-called host names today. This backward-compatible representation is
required in existing protocols like DNS, so that IDNs can be
introduced with no changes to the existing infrastructure. IDNA is
only meant for processing domain names, not free text.
<h3 class="section">6.1 Header file <code>idna.h</code></h3>
<p>To use the functions explained in this chapter, you need to include
the file <samp><span class="file">idna.h</span></samp> using:
<pre class="example"> #include <idna.h>
</pre>
<h3 class="section">6.2 Control Flags</h3>
<p>The IDNA <code>flags</code> parameter can take on the following values, or a
bit-wise inclusive or of any subset of the parameters:
<div class="defun">
— Return code: Idna_flags <b>IDNA_ALLOW_UNASSIGNED</b><var><a name="index-IDNA_005fALLOW_005fUNASSIGNED-80"></a></var><br>
<blockquote><p>Allow unassigned Unicode code points.
</p></blockquote></div>
<div class="defun">
— Return code: Idna_flags <b>IDNA_USE_STD3_ASCII_RULES</b><var><a name="index-IDNA_005fUSE_005fSTD3_005fASCII_005fRULES-81"></a></var><br>
<blockquote><p>Check output to make sure it is a STD3 conforming host name.
</p></blockquote></div>
<h3 class="section">6.3 Prefix String</h3>
<div class="defun">
— Macro: #define <b>IDNA_ACE_PREFIX</b><var><a name="index-IDNA_005fACE_005fPREFIX-82"></a></var><br>
<blockquote><p>String with the official IDNA prefix, <code>xn--</code>.
</p></blockquote></div>
<h3 class="section">6.4 Core Functions</h3>
<p>The idea behind the IDNA function names are as follows: the
<code>idna_to_ascii_4i</code> and <code>idna_to_unicode_44i</code> functions are
the core IDNA primitives. The <code>4</code> indicate that the function
takes UCS-4 strings (i.e., Unicode code points encoded in a 32-bit
unsigned integer type) of the specified length. The <code>i</code> indicate
that the data is written “inline” into the buffer. This means the
caller is responsible for allocating (and deallocating) the string,
and providing the library with the allocated length of the string.
The output length is written in the output length variable. The
remaining functions all contain the <code>z</code> indicator, which means
the strings are zero terminated. All output strings are allocated by
the library, and must be deallocated by the caller. The <code>4</code>
indicator again means that the string is UCS-4, the <code>8</code> means the
strings are UTF-8 and the <code>l</code> indicator means the strings are
encoded in the encoding used by the current locale.
<p>The functions provided are the following entry points:
<h4 class="subheading">idna_to_ascii_4i</h4>
<p><a name="idna_005fto_005fascii_005f4i"></a>
<div class="defun">
— Function: int <b>idna_to_ascii_4i</b> (<var>const uint32_t * in, size_t inlen, char * out, int flags</var>)<var><a name="index-idna_005fto_005fascii_005f4i-83"></a></var><br>
<blockquote><p><var>in</var>: input array with unicode code points.
<p><var>inlen</var>: length of input array with unicode code points.
<p><var>out</var>: output zero terminated string that must have room for at
least 63 characters plus the terminating zero.
<p><var>flags</var>: an <code>Idna_flags</code> value, e.g., <code>IDNA_ALLOW_UNASSIGNED</code> or
<code>IDNA_USE_STD3_ASCII_RULES</code>.
<p>The ToASCII operation takes a sequence of Unicode code points that
make up one domain label and transforms it into a sequence of code
points in the ASCII range (0..7F). If ToASCII succeeds, the
original sequence and the resulting sequence are equivalent labels.
<p>It is important to note that the ToASCII operation can fail. ToASCII
fails if any step of it fails. If any step of the ToASCII operation
fails on any label in a domain name, that domain name MUST NOT be used
as an internationalized domain name. The method for deadling with this
failure is application-specific.
<p>The inputs to ToASCII are a sequence of code points, the AllowUnassigned
flag, and the UseSTD3ASCIIRules flag. The output of ToASCII is either a
sequence of ASCII code points or a failure condition.
<p>ToASCII never alters a sequence of code points that are all in the ASCII
range to begin with (although it could fail). Applying the ToASCII
operation multiple times has exactly the same effect as applying it just
once.
<p><strong>Return value:</strong> Returns 0 on success, or an <code>Idna_rc</code> error code.
</p></blockquote></div>
<h4 class="subheading">idna_to_unicode_44i</h4>
<p><a name="idna_005fto_005funicode_005f44i"></a>
<div class="defun">
— Function: int <b>idna_to_unicode_44i</b> (<var>const uint32_t * in, size_t inlen, uint32_t * out, size_t * outlen, int flags</var>)<var><a name="index-idna_005fto_005funicode_005f44i-84"></a></var><br>
<blockquote><p><var>in</var>: input array with unicode code points.
<p><var>inlen</var>: length of input array with unicode code points.
<p><var>out</var>: output array with unicode code points.
<p><var>outlen</var>: on input, maximum size of output array with unicode code points,
on exit, actual size of output array with unicode code points.
<p><var>flags</var>: an <code>Idna_flags</code> value, e.g., <code>IDNA_ALLOW_UNASSIGNED</code> or
<code>IDNA_USE_STD3_ASCII_RULES</code>.
<p>The ToUnicode operation takes a sequence of Unicode code points
that make up one domain label and returns a sequence of Unicode
code points. If the input sequence is a label in ACE form, then the
result is an equivalent internationalized label that is not in ACE
form, otherwise the original sequence is returned unaltered.
<p>ToUnicode never fails. If any step fails, then the original input
sequence is returned immediately in that step.
<p>The Punycode decoder can never output more code points than it
inputs, but Nameprep can, and therefore ToUnicode can. Note that
the number of octets needed to represent a sequence of code points
depends on the particular character encoding used.
<p>The inputs to ToUnicode are a sequence of code points, the
AllowUnassigned flag, and the UseSTD3ASCIIRules flag. The output of
ToUnicode is always a sequence of Unicode code points.
<p><strong>Return value:</strong> Returns <code>Idna_rc</code> error condition, but it must only be
used for debugging purposes. The output buffer is always
guaranteed to contain the correct data according to the
specification (sans malloc induced errors). NB! This means that
you normally ignore the return code from this function, as
checking it means breaking the standard.
</p></blockquote></div>
<h3 class="section">6.5 Simplified ToASCII Interface</h3>
<h4 class="subheading">idna_to_ascii_4z</h4>
<p><a name="idna_005fto_005fascii_005f4z"></a>
<div class="defun">
— Function: int <b>idna_to_ascii_4z</b> (<var>const uint32_t * input, char ** output, int flags</var>)<var><a name="index-idna_005fto_005fascii_005f4z-85"></a></var><br>
<blockquote><p><var>input</var>: zero terminated input Unicode string.
<p><var>output</var>: pointer to newly allocated output string.
<p><var>flags</var>: an <code>Idna_flags</code> value, e.g., <code>IDNA_ALLOW_UNASSIGNED</code> or
<code>IDNA_USE_STD3_ASCII_RULES</code>.
<p>Convert UCS-4 domain name to ASCII string. The domain name may
contain several labels, separated by dots. The output buffer must
be deallocated by the caller.
<p><strong>Return value:</strong> Returns <code>IDNA_SUCCESS</code> on success, or error code.
</p></blockquote></div>
<h4 class="subheading">idna_to_ascii_8z</h4>
<p><a name="idna_005fto_005fascii_005f8z"></a>
<div class="defun">
— Function: int <b>idna_to_ascii_8z</b> (<var>const char * input, char ** output, int flags</var>)<var><a name="index-idna_005fto_005fascii_005f8z-86"></a></var><br>
<blockquote><p><var>input</var>: zero terminated input UTF-8 string.
<p><var>output</var>: pointer to newly allocated output string.
<p><var>flags</var>: an <code>Idna_flags</code> value, e.g., <code>IDNA_ALLOW_UNASSIGNED</code> or
<code>IDNA_USE_STD3_ASCII_RULES</code>.
<p>Convert UTF-8 domain name to ASCII string. The domain name may
contain several labels, separated by dots. The output buffer must
be deallocated by the caller.
<p><strong>Return value:</strong> Returns <code>IDNA_SUCCESS</code> on success, or error code.
</p></blockquote></div>
<h4 class="subheading">idna_to_ascii_lz</h4>
<p><a name="idna_005fto_005fascii_005flz"></a>
<div class="defun">
— Function: int <b>idna_to_ascii_lz</b> (<var>const char * input, char ** output, int flags</var>)<var><a name="index-idna_005fto_005fascii_005flz-87"></a></var><br>
<blockquote><p><var>input</var>: zero terminated input string encoded in the current locale's
character set.
<p><var>output</var>: pointer to newly allocated output string.
<p><var>flags</var>: an <code>Idna_flags</code> value, e.g., <code>IDNA_ALLOW_UNASSIGNED</code> or
<code>IDNA_USE_STD3_ASCII_RULES</code>.
<p>Convert domain name in the locale's encoding to ASCII string. The
domain name may contain several labels, separated by dots. The
output buffer must be deallocated by the caller.
<p><strong>Return value:</strong> Returns <code>IDNA_SUCCESS</code> on success, or error code.
</p></blockquote></div>
<h3 class="section">6.6 Simplified ToUnicode Interface</h3>
<h4 class="subheading">idna_to_unicode_4z4z</h4>
<p><a name="idna_005fto_005funicode_005f4z4z"></a>
<div class="defun">
— Function: int <b>idna_to_unicode_4z4z</b> (<var>const uint32_t * input, uint32_t ** output, int flags</var>)<var><a name="index-idna_005fto_005funicode_005f4z4z-88"></a></var><br>
<blockquote><p><var>input</var>: zero-terminated Unicode string.
<p><var>output</var>: pointer to newly allocated output Unicode string.
<p><var>flags</var>: an <code>Idna_flags</code> value, e.g., <code>IDNA_ALLOW_UNASSIGNED</code> or
<code>IDNA_USE_STD3_ASCII_RULES</code>.
<p>Convert possibly ACE encoded domain name in UCS-4 format into a
UCS-4 string. The domain name may contain several labels,
separated by dots. The output buffer must be deallocated by the
caller.
<p><strong>Return value:</strong> Returns <code>IDNA_SUCCESS</code> on success, or error code.
</p></blockquote></div>
<h4 class="subheading">idna_to_unicode_8z4z</h4>
<p><a name="idna_005fto_005funicode_005f8z4z"></a>
<div class="defun">
— Function: int <b>idna_to_unicode_8z4z</b> (<var>const char * input, uint32_t ** output, int flags</var>)<var><a name="index-idna_005fto_005funicode_005f8z4z-89"></a></var><br>
<blockquote><p><var>input</var>: zero-terminated UTF-8 string.
<p><var>output</var>: pointer to newly allocated output Unicode string.
<p><var>flags</var>: an <code>Idna_flags</code> value, e.g., <code>IDNA_ALLOW_UNASSIGNED</code> or
<code>IDNA_USE_STD3_ASCII_RULES</code>.
<p>Convert possibly ACE encoded domain name in UTF-8 format into a
UCS-4 string. The domain name may contain several labels,
separated by dots. The output buffer must be deallocated by the
caller.
<p><strong>Return value:</strong> Returns <code>IDNA_SUCCESS</code> on success, or error code.
</p></blockquote></div>
<h4 class="subheading">idna_to_unicode_8z8z</h4>
<p><a name="idna_005fto_005funicode_005f8z8z"></a>
<div class="defun">
— Function: int <b>idna_to_unicode_8z8z</b> (<var>const char * input, char ** output, int flags</var>)<var><a name="index-idna_005fto_005funicode_005f8z8z-90"></a></var><br>
<blockquote><p><var>input</var>: zero-terminated UTF-8 string.
<p><var>output</var>: pointer to newly allocated output UTF-8 string.
<p><var>flags</var>: an <code>Idna_flags</code> value, e.g., <code>IDNA_ALLOW_UNASSIGNED</code> or
<code>IDNA_USE_STD3_ASCII_RULES</code>.
<p>Convert possibly ACE encoded domain name in UTF-8 format into a
UTF-8 string. The domain name may contain several labels,
separated by dots. The output buffer must be deallocated by the
caller.
<p><strong>Return value:</strong> Returns <code>IDNA_SUCCESS</code> on success, or error code.
</p></blockquote></div>
<h4 class="subheading">idna_to_unicode_8zlz</h4>
<p><a name="idna_005fto_005funicode_005f8zlz"></a>
<div class="defun">
— Function: int <b>idna_to_unicode_8zlz</b> (<var>const char * input, char ** output, int flags</var>)<var><a name="index-idna_005fto_005funicode_005f8zlz-91"></a></var><br>
<blockquote><p><var>input</var>: zero-terminated UTF-8 string.
<p><var>output</var>: pointer to newly allocated output string encoded in the
current locale's character set.
<p><var>flags</var>: an <code>Idna_flags</code> value, e.g., <code>IDNA_ALLOW_UNASSIGNED</code> or
<code>IDNA_USE_STD3_ASCII_RULES</code>.
<p>Convert possibly ACE encoded domain name in UTF-8 format into a
string encoded in the current locale's character set. The domain
name may contain several labels, separated by dots. The output
buffer must be deallocated by the caller.
<p><strong>Return value:</strong> Returns <code>IDNA_SUCCESS</code> on success, or error code.
</p></blockquote></div>
<h4 class="subheading">idna_to_unicode_lzlz</h4>
<p><a name="idna_005fto_005funicode_005flzlz"></a>
<div class="defun">
— Function: int <b>idna_to_unicode_lzlz</b> (<var>const char * input, char ** output, int flags</var>)<var><a name="index-idna_005fto_005funicode_005flzlz-92"></a></var><br>
<blockquote><p><var>input</var>: zero-terminated string encoded in the current locale's
character set.
<p><var>output</var>: pointer to newly allocated output string encoded in the
current locale's character set.
<p><var>flags</var>: an <code>Idna_flags</code> value, e.g., <code>IDNA_ALLOW_UNASSIGNED</code> or
<code>IDNA_USE_STD3_ASCII_RULES</code>.
<p>Convert possibly ACE encoded domain name in the locale's character
set into a string encoded in the current locale's character set.
The domain name may contain several labels, separated by dots. The
output buffer must be deallocated by the caller.
<p><strong>Return value:</strong> Returns <code>IDNA_SUCCESS</code> on success, or error code.
</p></blockquote></div>
<h3 class="section">6.7 Error Handling</h3>
<h4 class="subheading">idna_strerror</h4>
<p><a name="idna_005fstrerror"></a>
<div class="defun">
— Function: const char * <b>idna_strerror</b> (<var>Idna_rc rc</var>)<var><a name="index-idna_005fstrerror-93"></a></var><br>
<blockquote><p><var>rc</var>: an <code>Idna_rc</code> return code.
<p>Convert a return code integer to a text string. This string can be
used to output a diagnostic message to the user.
<p><strong>IDNA_SUCCESS:</strong> Successful operation. This value is guaranteed to
always be zero, the remaining ones are only guaranteed to hold
non-zero values, for logical comparison purposes.
<p><strong>IDNA_STRINGPREP_ERROR:</strong> Error during string preparation.
<p><strong>IDNA_PUNYCODE_ERROR:</strong> Error during punycode operation.
<p><strong>IDNA_CONTAINS_NON_LDH:</strong> For IDNA_USE_STD3_ASCII_RULES, indicate that
the string contains non-LDH ASCII characters.
<p><strong>IDNA_CONTAINS_MINUS:</strong> For IDNA_USE_STD3_ASCII_RULES, indicate that
the string contains a leading or trailing hyphen-minus (U+002D).
<p><strong>IDNA_INVALID_LENGTH:</strong> The final output string is not within the
(inclusive) range 1 to 63 characters.
<p><strong>IDNA_NO_ACE_PREFIX:</strong> The string does not contain the ACE prefix
(for ToUnicode).
<p><strong>IDNA_ROUNDTRIP_VERIFY_ERROR:</strong> The ToASCII operation on output
string does not equal the input.
<p><strong>IDNA_CONTAINS_ACE_PREFIX:</strong> The input contains the ACE prefix (for
ToASCII).
<p><strong>IDNA_ICONV_ERROR:</strong> Could not convert string in locale encoding.
<p><strong>IDNA_MALLOC_ERROR:</strong> Could not allocate buffer (this is typically a
fatal error).
<p><strong>IDNA_DLOPEN_ERROR:</strong> Could not dlopen the libcidn DSO (only used
internally in libc).
<p><strong>Return value:</strong> Returns a pointer to a statically allocated string
containing a description of the error with the return code <code>rc</code>.
</p></blockquote></div>
<!-- ********************************************************** -->
<!-- ********************** TLD Functions ********************* -->
<!-- ********************************************************** -->
<div class="node">
<a name="TLD-Functions"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#PR29-Functions">PR29 Functions</a>,
Previous: <a rel="previous" accesskey="p" href="#IDNA-Functions">IDNA Functions</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">7 TLD Functions</h2>
<p><a name="index-TLD-Functions-94"></a>
Organizations that manage some Top Level Domains (<acronym>TLD</acronym>s) have
published tables with characters they accept within the domain. The
reason may be to reduce complexity that come from using the full
Unicode range, and to protect themselves from future (backwards
incompatible) changes in the IDN or Unicode specifications. Libidn
implement an infrastructure for defining and checking strings against
such tables. Libidn also ship some tables from <acronym>TLD</acronym>s that we
have managed to get permission to use them from. Because these tables
are even less static than Unicode or StringPrep tables, it is likely
that they will be updated from time to time (even in backwards
incompatibe ways). The Libidn interface provide a “version” field
for each <acronym>TLD</acronym> table, which can be compared for equality to
guarantee the same operation over time.
<p>From a design point of view, you can regard the <acronym>TLD</acronym> tables
for IDN as the “localization” step that come after the
“internationalization” step provided by the IETF standards.
<p>The TLD functionality rely on up-to-date tables. The latest version
of Libidn aim to provide these, but tables with unclear copying
conditions, or generally experimental tables, are not included. Some
such tables can be found at <a href="http://tldchk.berlios.de">http://tldchk.berlios.de</a>.
<h3 class="section">7.1 Header file <code>tld.h</code></h3>
<p>To use the functions explained in this chapter, you need to include
the file <samp><span class="file">tld.h</span></samp> using:
<pre class="example"> #include <tld.h>
</pre>
<!-- @section Data Types -->
<!-- @deftp {Data type} {Tld_table_element} @var{start} @var{end} -->
<!-- @example -->
<!-- /* Interval of valid code points in the TLD. */ -->
<!-- struct Tld_table_element -->
<!-- @{ -->
<!-- uint32_t start; /* Start of range. */ -->
<!-- uint32_t end; /* End of range, end == start if single. */ -->
<!-- @}; -->
<!-- typedef struct Tld_table_element Tld_table_element; -->
<!-- @end example -->
<!-- This @code{struct} contain the @var{start} and @var{end} positions -->
<!-- (inclusive) of a range. If the range is a single (i.e., starts and -->
<!-- ends in the same character), then set @var{end} to the same as -->
<!-- @var{start}. This structure is normally used as an array. -->
<!-- @end deftp -->
<!-- @deftp {Data type} {Tld_table} @var{name} @var{version} @var{nvalid} @var{valid} -->
<!-- @example -->
<!-- /* List valid code points in a TLD. */ -->
<!-- struct Tld_table -->
<!-- @{ -->
<!-- char *name; /* TLD name, e.g., "no". */ -->
<!-- char *version; /* Version string from TLD file. */ -->
<!-- size_t nvalid; /* Number of entries in data. */ -->
<!-- Tld_table_element *valid[]; /* Sorted array of valid code points. */ -->
<!-- @}; -->
<!-- typedef struct Tld_table Tld_table; -->
<!-- @end example -->
<!-- In this @code{struct}, the @var{name} field is a string (@samp{char*}) -->
<!-- indicating the TLD name (e.g., ``no''). The @var{version} field is a -->
<!-- string (@samp{char*}) containing a free form humanly readable string -->
<!-- that can be used for equality comparison to compare different versions -->
<!-- of the table. The @var{nvalid} field indicate how many entries there -->
<!-- are in @var{valid}, which brings us finally to @var{valid} that -->
<!-- contain the actual code points that are valid for this TLD (see -->
<!-- @code{Tld_table_element} above). -->
<!-- @end deftp -->
<h3 class="section">7.2 Core Functions</h3>
<h4 class="subheading">tld_check_4t</h4>
<p><a name="tld_005fcheck_005f4t"></a>
<div class="defun">
— Function: int <b>tld_check_4t</b> (<var>const uint32_t * in, size_t inlen, size_t * errpos, const Tld_table * tld</var>)<var><a name="index-tld_005fcheck_005f4t-95"></a></var><br>
<blockquote><p><var>in</var>: Array of unicode code points to process. Does not need to be
zero terminated.
<p><var>inlen</var>: Number of unicode code points.
<p><var>errpos</var>: Position of offending character is returned here.
<p><var>tld</var>: A <code>Tld_table</code> data structure representing the restrictions for
which the input should be tested.
<p>Test each of the code points in <code>in</code> for whether or not
they are allowed by the data structure in <code>tld</code>, return
the position of the first character for which this is not
the case in <code>errpos</code>.
<p><strong>Return value:</strong> Returns the <code>Tld_rc</code> value <code>TLD_SUCCESS</code> if all code
points are valid or when <code>tld</code> is null, <code>TLD_INVALID</code> if a
character is not allowed, or additional error codes on general
failure conditions.
</p></blockquote></div>
<h4 class="subheading">tld_check_4tz</h4>
<p><a name="tld_005fcheck_005f4tz"></a>
<div class="defun">
— Function: int <b>tld_check_4tz</b> (<var>const uint32_t * in, size_t * errpos, const Tld_table * tld</var>)<var><a name="index-tld_005fcheck_005f4tz-96"></a></var><br>
<blockquote><p><var>in</var>: Zero terminated array of unicode code points to process.
<p><var>errpos</var>: Position of offending character is returned here.
<p><var>tld</var>: A <code>Tld_table</code> data structure representing the restrictions for
which the input should be tested.
<p>Test each of the code points in <code>in</code> for whether or not
they are allowed by the data structure in <code>tld</code>, return
the position of the first character for which this is not
the case in <code>errpos</code>.
<p><strong>Return value:</strong> Returns the <code>Tld_rc</code> value <code>TLD_SUCCESS</code> if all code
points are valid or when <code>tld</code> is null, <code>TLD_INVALID</code> if a
character is not allowed, or additional error codes on general
failure conditions.
</p></blockquote></div>
<h3 class="section">7.3 Utility Functions</h3>
<h4 class="subheading">tld_get_4</h4>
<p><a name="tld_005fget_005f4"></a>
<div class="defun">
— Function: int <b>tld_get_4</b> (<var>const uint32_t * in, size_t inlen, char ** out</var>)<var><a name="index-tld_005fget_005f4-97"></a></var><br>
<blockquote><p><var>in</var>: Array of unicode code points to process. Does not need to be
zero terminated.
<p><var>inlen</var>: Number of unicode code points.
<p><var>out</var>: Zero terminated ascii result string pointer.
<p>Isolate the top-level domain of <code>in</code> and return it as an ASCII
string in <code>out</code>.
<p><strong>Return value:</strong> Return <code>TLD_SUCCESS</code> on success, or the corresponding
<code>Tld_rc</code> error code otherwise.
</p></blockquote></div>
<h4 class="subheading">tld_get_4z</h4>
<p><a name="tld_005fget_005f4z"></a>
<div class="defun">
— Function: int <b>tld_get_4z</b> (<var>const uint32_t * in, char ** out</var>)<var><a name="index-tld_005fget_005f4z-98"></a></var><br>
<blockquote><p><var>in</var>: Zero terminated array of unicode code points to process.
<p><var>out</var>: Zero terminated ascii result string pointer.
<p>Isolate the top-level domain of <code>in</code> and return it as an ASCII
string in <code>out</code>.
<p><strong>Return value:</strong> Return <code>TLD_SUCCESS</code> on success, or the corresponding
<code>Tld_rc</code> error code otherwise.
</p></blockquote></div>
<h4 class="subheading">tld_get_z</h4>
<p><a name="tld_005fget_005fz"></a>
<div class="defun">
— Function: int <b>tld_get_z</b> (<var>const char * in, char ** out</var>)<var><a name="index-tld_005fget_005fz-99"></a></var><br>
<blockquote><p><var>in</var>: Zero terminated character array to process.
<p><var>out</var>: Zero terminated ascii result string pointer.
<p>Isolate the top-level domain of <code>in</code> and return it as an ASCII
string in <code>out</code>. The input string <code>in</code> may be UTF-8, ISO-8859-1 or
any ASCII compatible character encoding.
<p><strong>Return value:</strong> Return <code>TLD_SUCCESS</code> on success, or the corresponding
<code>Tld_rc</code> error code otherwise.
</p></blockquote></div>
<h4 class="subheading">tld_get_table</h4>
<p><a name="tld_005fget_005ftable"></a>
<div class="defun">
— Function: const Tld_table * <b>tld_get_table</b> (<var>const char * tld, const Tld_table ** tables</var>)<var><a name="index-tld_005fget_005ftable-100"></a></var><br>
<blockquote><p><var>tld</var>: TLD name (e.g. "com") as zero terminated ASCII byte string.
<p><var>tables</var>: Zero terminated array of <code>Tld_table</code> info-structures for
TLDs.
<p>Get the TLD table for a named TLD by searching through the given
TLD table array.
<p><strong>Return value:</strong> Return structure corresponding to TLD <code>tld</code> by going
thru <code>tables</code>, or return <code>NULL</code> if no such structure is found.
</p></blockquote></div>
<h4 class="subheading">tld_default_table</h4>
<p><a name="tld_005fdefault_005ftable"></a>
<div class="defun">
— Function: const Tld_table * <b>tld_default_table</b> (<var>const char * tld, const Tld_table ** overrides</var>)<var><a name="index-tld_005fdefault_005ftable-101"></a></var><br>
<blockquote><p><var>tld</var>: TLD name (e.g. "com") as zero terminated ASCII byte string.
<p><var>overrides</var>: Additional zero terminated array of <code>Tld_table</code>
info-structures for TLDs, or <code>NULL</code> to only use library deault
tables.
<p>Get the TLD table for a named TLD, using the internal defaults,
possibly overrided by the (optional) supplied tables.
<p><strong>Return value:</strong> Return structure corresponding to TLD <code>tld_str</code>, first
looking through <code>overrides</code> then thru built-in list, or <code>NULL</code> if
no such structure found.
</p></blockquote></div>
<h3 class="section">7.4 High-Level Wrapper Functions</h3>
<h4 class="subheading">tld_check_4</h4>
<p><a name="tld_005fcheck_005f4"></a>
<div class="defun">
— Function: int <b>tld_check_4</b> (<var>const uint32_t * in, size_t inlen, size_t * errpos, const Tld_table ** overrides</var>)<var><a name="index-tld_005fcheck_005f4-102"></a></var><br>
<blockquote><p><var>in</var>: Array of unicode code points to process. Does not need to be
zero terminated.
<p><var>inlen</var>: Number of unicode code points.
<p><var>errpos</var>: Position of offending character is returned here.
<p><var>overrides</var>: A <code>Tld_table</code> array of additional domain restriction
structures that complement and supersede the built-in information.
<p>Test each of the code points in <code>in</code> for whether or not they are
allowed by the information in <code>overrides</code> or by the built-in TLD
restriction data. When data for the same TLD is available both
internally and in <code>overrides</code>, the information in <code>overrides</code> takes
precedence. If several entries for a specific TLD are found, the
first one is used. If <code>overrides</code> is <code>NULL</code>, only the built-in
information is used. The position of the first offending character
is returned in <code>errpos</code>.
<p><strong>Return value:</strong> Returns the <code>Tld_rc</code> value <code>TLD_SUCCESS</code> if all code
points are valid or when <code>tld</code> is null, <code>TLD_INVALID</code> if a
character is not allowed, or additional error codes on general
failure conditions.
</p></blockquote></div>
<h4 class="subheading">tld_check_4z</h4>
<p><a name="tld_005fcheck_005f4z"></a>
<div class="defun">
— Function: int <b>tld_check_4z</b> (<var>const uint32_t * in, size_t * errpos, const Tld_table ** overrides</var>)<var><a name="index-tld_005fcheck_005f4z-103"></a></var><br>
<blockquote><p><var>in</var>: Zero-terminated array of unicode code points to process.
<p><var>errpos</var>: Position of offending character is returned here.
<p><var>overrides</var>: A <code>Tld_table</code> array of additional domain restriction
structures that complement and supersede the built-in information.
<p>Test each of the code points in <code>in</code> for whether or not they are
allowed by the information in <code>overrides</code> or by the built-in TLD
restriction data. When data for the same TLD is available both
internally and in <code>overrides</code>, the information in <code>overrides</code> takes
precedence. If several entries for a specific TLD are found, the
first one is used. If <code>overrides</code> is <code>NULL</code>, only the built-in
information is used. The position of the first offending character
is returned in <code>errpos</code>.
<p><strong>Return value:</strong> Returns the <code>Tld_rc</code> value <code>TLD_SUCCESS</code> if all code
points are valid or when <code>tld</code> is null, <code>TLD_INVALID</code> if a
character is not allowed, or additional error codes on general
failure conditions.
</p></blockquote></div>
<h4 class="subheading">tld_check_8z</h4>
<p><a name="tld_005fcheck_005f8z"></a>
<div class="defun">
— Function: int <b>tld_check_8z</b> (<var>const char * in, size_t * errpos, const Tld_table ** overrides</var>)<var><a name="index-tld_005fcheck_005f8z-104"></a></var><br>
<blockquote><p><var>in</var>: Zero-terminated UTF8 string to process.
<p><var>errpos</var>: Position of offending character is returned here.
<p><var>overrides</var>: A <code>Tld_table</code> array of additional domain restriction
structures that complement and supersede the built-in information.
<p>Test each of the characters in <code>in</code> for whether or not they are
allowed by the information in <code>overrides</code> or by the built-in TLD
restriction data. When data for the same TLD is available both
internally and in <code>overrides</code>, the information in <code>overrides</code> takes
precedence. If several entries for a specific TLD are found, the
first one is used. If <code>overrides</code> is <code>NULL</code>, only the built-in
information is used. The position of the first offending character
is returned in <code>errpos</code>. Note that the error position refers to the
decoded character offset rather than the byte position in the
string.
<p><strong>Return value:</strong> Returns the <code>Tld_rc</code> value <code>TLD_SUCCESS</code> if all
characters are valid or when <code>tld</code> is null, <code>TLD_INVALID</code> if a
character is not allowed, or additional error codes on general
failure conditions.
</p></blockquote></div>
<h4 class="subheading">tld_check_lz</h4>
<p><a name="tld_005fcheck_005flz"></a>
<div class="defun">
— Function: int <b>tld_check_lz</b> (<var>const char * in, size_t * errpos, const Tld_table ** overrides</var>)<var><a name="index-tld_005fcheck_005flz-105"></a></var><br>
<blockquote><p><var>in</var>: Zero-terminated string in the current locales encoding to process.
<p><var>errpos</var>: Position of offending character is returned here.
<p><var>overrides</var>: A <code>Tld_table</code> array of additional domain restriction
structures that complement and supersede the built-in information.
<p>Test each of the characters in <code>in</code> for whether or not they are
allowed by the information in <code>overrides</code> or by the built-in TLD
restriction data. When data for the same TLD is available both
internally and in <code>overrides</code>, the information in <code>overrides</code> takes
precedence. If several entries for a specific TLD are found, the
first one is used. If <code>overrides</code> is <code>NULL</code>, only the built-in
information is used. The position of the first offending character
is returned in <code>errpos</code>. Note that the error position refers to the
decoded character offset rather than the byte position in the
string.
<p><strong>Return value:</strong> Returns the <code>Tld_rc</code> value <code>TLD_SUCCESS</code> if all
characters are valid or when <code>tld</code> is null, <code>TLD_INVALID</code> if a
character is not allowed, or additional error codes on general
failure conditions.
</p></blockquote></div>
<h3 class="section">7.5 Error Handling</h3>
<h4 class="subheading">tld_strerror</h4>
<p><a name="tld_005fstrerror"></a>
<div class="defun">
— Function: const char * <b>tld_strerror</b> (<var>Tld_rc rc</var>)<var><a name="index-tld_005fstrerror-106"></a></var><br>
<blockquote><p><var>rc</var>: tld return code
<p>Convert a return code integer to a text string. This string can be
used to output a diagnostic message to the user.
<p><strong>TLD_SUCCESS:</strong> Successful operation. This value is guaranteed to
always be zero, the remaining ones are only guaranteed to hold
non-zero values, for logical comparison purposes.
<p><strong>TLD_INVALID:</strong> Invalid character found.
<p><strong>TLD_NODATA:</strong> No input data was provided.
<p><strong>TLD_MALLOC_ERROR:</strong> Error during memory allocation.
<p><strong>TLD_ICONV_ERROR:</strong> Error during iconv string conversion.
<p><strong>TLD_NO_TLD:</strong> No top-level domain found in domain string.
<p><strong>Return value:</strong> Returns a pointer to a statically allocated string
containing a description of the error with the return code <code>rc</code>.
</p></blockquote></div>
<!-- ********************************************************** -->
<!-- ********************** PR29 Functions ******************** -->
<!-- ********************************************************** -->
<div class="node">
<a name="PR29-Functions"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Examples">Examples</a>,
Previous: <a rel="previous" accesskey="p" href="#TLD-Functions">TLD Functions</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">8 PR29 Functions</h2>
<p><a name="index-PR29-Functions-107"></a>
A deficiency in the specification of Unicode Normalization Forms has
been found. The consequence is that some strings can be normalized
into different strings by different implementations. In other words,
two different implementations may return different output for the same
input (because the interpretation of the specification is
ambiguous). Further, an implementation invoked again on the one of the
output strings may return a different string (because one of the
interpretation of the ambiguous specification make normalization
non-idempotent). Fortunately, only a select few character sequence
exhibit this problem, and none of them are expected to occur in
natural languages (due to different linguistic uses of the involved
characters).
<p>A full discussion of the problem may be found at:
<p><a href="http://www.unicode.org/review/pr-29.html">http://www.unicode.org/review/pr-29.html</a>
<p>The PR29 functions below allow you to detect the problem sequence. So
when would you want to use these functions? For most applications,
such as those using Nameprep for IDN, this is likely only to be an
interoperability problem. Thus, you may not want to care about it, as
the character sequences will rarely occur naturally. However, if you
are using a profile, such as SASLPrep, to process authentication
tokens; authorization tokens; or passwords, there is a real danger
that attackers may try to use the peculiarities in these strings to
attack parts of your system. As only a small number of strings, and
no naturally occurring strings, exhibit this problem, the conservative
approach of rejecting the strings is recommended. If this approach is
not used, you should instead verify that all parts of your system,
that process the tokens and passwords, use a NFKC implementation that
produce the same output for the same input.
<p>Technically inclined readers may be interested in knowing more about
the implementation aspects of the PR29 flaw. See <a href="#PR29-discussion">PR29 discussion</a>.
<h3 class="section">8.1 Header file <code>pr29.h</code></h3>
<p>To use the functions explained in this chapter, you need to include
the file <samp><span class="file">pr29.h</span></samp> using:
<pre class="example"> #include <pr29.h>
</pre>
<h3 class="section">8.2 Core Functions</h3>
<h4 class="subheading">pr29_4</h4>
<p><a name="pr29_005f4"></a>
<div class="defun">
— Function: int <b>pr29_4</b> (<var>const uint32_t * in, size_t len</var>)<var><a name="index-pr29_005f4-108"></a></var><br>
<blockquote><p><var>in</var>: input array with unicode code points.
<p><var>len</var>: length of input array with unicode code points.
<p>Check the input to see if it may be normalized into different
strings by different NFKC implementations, due to an anomaly in the
NFKC specifications.
<p><strong>Return value:</strong> Returns the <code>Pr29_rc</code> value <code>PR29_SUCCESS</code> on success,
and <code>PR29_PROBLEM</code> if the input sequence is a "problem sequence"
(i.e., may be normalized into different strings by different
implementations).
</p></blockquote></div>
<h3 class="section">8.3 Utility Functions</h3>
<h4 class="subheading">pr29_4z</h4>
<p><a name="pr29_005f4z"></a>
<div class="defun">
— Function: int <b>pr29_4z</b> (<var>const uint32_t * in</var>)<var><a name="index-pr29_005f4z-109"></a></var><br>
<blockquote><p><var>in</var>: zero terminated array of Unicode code points.
<p>Check the input to see if it may be normalized into different
strings by different NFKC implementations, due to an anomaly in the
NFKC specifications.
<p><strong>Return value:</strong> Returns the <code>Pr29_rc</code> value <code>PR29_SUCCESS</code> on success,
and <code>PR29_PROBLEM</code> if the input sequence is a "problem sequence"
(i.e., may be normalized into different strings by different
implementations).
</p></blockquote></div>
<h4 class="subheading">pr29_8z</h4>
<p><a name="pr29_005f8z"></a>
<div class="defun">
— Function: int <b>pr29_8z</b> (<var>const char * in</var>)<var><a name="index-pr29_005f8z-110"></a></var><br>
<blockquote><p><var>in</var>: zero terminated input UTF-8 string.
<p>Check the input to see if it may be normalized into different
strings by different NFKC implementations, due to an anomaly in the
NFKC specifications.
<p><strong>Return value:</strong> Returns the <code>Pr29_rc</code> value <code>PR29_SUCCESS</code> on success,
and <code>PR29_PROBLEM</code> if the input sequence is a "problem sequence"
(i.e., may be normalized into different strings by different
implementations), or <code>PR29_STRINGPREP_ERROR</code> if there was a
problem converting the string from UTF-8 to UCS-4.
</p></blockquote></div>
<h3 class="section">8.4 Error Handling</h3>
<h4 class="subheading">pr29_strerror</h4>
<p><a name="pr29_005fstrerror"></a>
<div class="defun">
— Function: const char * <b>pr29_strerror</b> (<var>Pr29_rc rc</var>)<var><a name="index-pr29_005fstrerror-111"></a></var><br>
<blockquote><p><var>rc</var>: an <code>Pr29_rc</code> return code.
<p>Convert a return code integer to a text string. This string can be
used to output a diagnostic message to the user.
<p><strong>PR29_SUCCESS:</strong> Successful operation. This value is guaranteed to
always be zero, the remaining ones are only guaranteed to hold
non-zero values, for logical comparison purposes.
<p><strong>PR29_PROBLEM:</strong> A problem sequence was encountered.
<p><strong>PR29_STRINGPREP_ERROR:</strong> The character set conversion failed (only
for <code>pr29_8()</code> and <code>pr29_8z()</code>).
<p><strong>Return value:</strong> Returns a pointer to a statically allocated string
containing a description of the error with the return code <code>rc</code>.
</p></blockquote></div>
<!-- ********************************************************** -->
<!-- *********************** Examples *********************** -->
<!-- ********************************************************** -->
<div class="node">
<a name="Examples"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Invoking-idn">Invoking idn</a>,
Previous: <a rel="previous" accesskey="p" href="#PR29-Functions">PR29 Functions</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">9 Examples</h2>
<p><a name="index-Examples-112"></a>
This chapter contains example code which illustrate how `Libidn' can
be used when writing your own application.
<ul class="menu">
<li><a accesskey="1" href="#Example-1">Example 1</a>: Example using stringprep.
<li><a accesskey="2" href="#Example-2">Example 2</a>: Example using punycode.
<li><a accesskey="3" href="#Example-3">Example 3</a>: Example using IDNA ToASCII.
<li><a accesskey="4" href="#Example-4">Example 4</a>: Example using IDNA ToUnicode.
<li><a accesskey="5" href="#Example-5">Example 5</a>: Example using TLD checking.
</ul>
<div class="node">
<a name="Example-1"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Example-2">Example 2</a>,
Up: <a rel="up" accesskey="u" href="#Examples">Examples</a>
</div>
<h3 class="section">9.1 Example 1</h3>
<p>This example demonstrates how the stringprep functions are used.
<pre class="verbatim">/* example.c --- Example code showing how to use stringprep().
* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
* Simon Josefsson
*
* This file is part of GNU Libidn.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h> /* setlocale() */
#include <stringprep.h>
/*
* Compiling using libtool and pkg-config is recommended:
*
* $ libtool cc -o example example.c `pkg-config --cflags --libs libidn`
* $ ./example
* Input string encoded as `ISO-8859-1': ª
* Before locale2utf8 (length 2): aa 0a
* Before stringprep (length 3): c2 aa 0a
* After stringprep (length 2): 61 0a
* $
*
*/
int
main (void)
{
char buf[BUFSIZ];
char *p;
int rc;
size_t i;
setlocale (LC_ALL, "");
printf ("Input string encoded as `%s': ", stringprep_locale_charset ());
fflush (stdout);
fgets (buf, BUFSIZ, stdin);
printf ("Before locale2utf8 (length %d): ", strlen (buf));
for (i = 0; i < strlen (buf); i++)
printf ("%02x ", buf[i] & 0xFF);
printf ("\n");
p = stringprep_locale_to_utf8 (buf);
if (p)
{
strcpy (buf, p);
free (p);
}
else
printf ("Could not convert string to UTF-8, continuing anyway...\n");
printf ("Before stringprep (length %d): ", strlen (buf));
for (i = 0; i < strlen (buf); i++)
printf ("%02x ", buf[i] & 0xFF);
printf ("\n");
rc = stringprep (buf, BUFSIZ, 0, stringprep_nameprep);
if (rc != STRINGPREP_OK)
printf ("Stringprep failed (%d): %s\n", rc, stringprep_strerror (rc));
else
{
printf ("After stringprep (length %d): ", strlen (buf));
for (i = 0; i < strlen (buf); i++)
printf ("%02x ", buf[i] & 0xFF);
printf ("\n");
}
return 0;
}
</pre>
<div class="node">
<a name="Example-2"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Example-3">Example 3</a>,
Previous: <a rel="previous" accesskey="p" href="#Example-1">Example 1</a>,
Up: <a rel="up" accesskey="u" href="#Examples">Examples</a>
</div>
<h3 class="section">9.2 Example 2</h3>
<p>This example demonstrates how the punycode functions are used.
<pre class="verbatim">/* example2.c --- Example code showing how to use punycode.
* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
* Simon Josefsson
* Copyright (C) 2002 Adam M. Costello
*
* This file is part of GNU Libidn.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <locale.h> /* setlocale() */
/*
* This file is derived from RFC 3492 written by Adam M. Costello.
*
* Disclaimer and license: Regarding this entire document or any
* portion of it (including the pseudocode and C code), the author
* makes no guarantees and is not responsible for any damage resulting
* from its use. The author grants irrevocable permission to anyone
* to use, modify, and distribute it in any way that does not diminish
* the rights of anyone else to use, modify, and distribute it,
* provided that redistributed derivative works do not contain
* misleading author or version information. Derivative works need
* not be licensed under similar terms.
*
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <punycode.h>
/* For testing, we'll just set some compile-time limits rather than */
/* use malloc(), and set a compile-time option rather than using a */
/* command-line option. */
enum
{
unicode_max_length = 256,
ace_max_length = 256
};
static void
usage (char **argv)
{
fprintf (stderr,
"\n"
"%s -e reads code points and writes a Punycode string.\n"
"%s -d reads a Punycode string and writes code points.\n"
"\n"
"Input and output are plain text in the native character set.\n"
"Code points are in the form u+hex separated by whitespace.\n"
"Although the specification allows Punycode strings to contain\n"
"any characters from the ASCII repertoire, this test code\n"
"supports only the printable characters, and needs the Punycode\n"
"string to be followed by a newline.\n"
"The case of the u in u+hex is the force-to-uppercase flag.\n",
argv[0], argv[0]);
exit (EXIT_FAILURE);
}
static void
fail (const char *msg)
{
fputs (msg, stderr);
exit (EXIT_FAILURE);
}
static const char too_big[] =
"input or output is too large, recompile with larger limits\n";
static const char invalid_input[] = "invalid input\n";
static const char overflow[] = "arithmetic overflow\n";
static const char io_error[] = "I/O error\n";
/* The following string is used to convert printable */
/* characters between ASCII and the native charset: */
static const char print_ascii[] = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" " !\"#$%&'()*+,-./" "0123456789:;<=>?" "\0x40" /* at sign */
"ABCDEFGHIJKLMNO"
"PQRSTUVWXYZ[\\]^_" "`abcdefghijklmno" "pqrstuvwxyz{|}~\n";
int
main (int argc, char **argv)
{
enum punycode_status status;
int r;
size_t input_length, output_length, j;
unsigned char case_flags[unicode_max_length];
setlocale (LC_ALL, "");
if (argc != 2)
usage (argv);
if (argv[1][0] != '-')
usage (argv);
if (argv[1][2] != 0)
usage (argv);
if (argv[1][1] == 'e')
{
uint32_t input[unicode_max_length];
unsigned long codept;
char output[ace_max_length + 1], uplus[3];
int c;
/* Read the input code points: */
input_length = 0;
for (;;)
{
r = scanf ("%2s%lx", uplus, &codept);
if (ferror (stdin))
fail (io_error);
if (r == EOF || r == 0)
break;
if (r != 2 || uplus[1] != '+' || codept > (uint32_t) - 1)
{
fail (invalid_input);
}
if (input_length == unicode_max_length)
fail (too_big);
if (uplus[0] == 'u')
case_flags[input_length] = 0;
else if (uplus[0] == 'U')
case_flags[input_length] = 1;
else
fail (invalid_input);
input[input_length++] = codept;
}
/* Encode: */
output_length = ace_max_length;
status = punycode_encode (input_length, input, case_flags,
&output_length, output);
if (status == punycode_bad_input)
fail (invalid_input);
if (status == punycode_big_output)
fail (too_big);
if (status == punycode_overflow)
fail (overflow);
assert (status == punycode_success);
/* Convert to native charset and output: */
for (j = 0; j < output_length; ++j)
{
c = output[j];
assert (c >= 0 && c <= 127);
if (print_ascii[c] == 0)
fail (invalid_input);
output[j] = print_ascii[c];
}
output[j] = 0;
r = puts (output);
if (r == EOF)
fail (io_error);
return EXIT_SUCCESS;
}
if (argv[1][1] == 'd')
{
char input[ace_max_length + 2], *p, *pp;
uint32_t output[unicode_max_length];
/* Read the Punycode input string and convert to ASCII: */
fgets (input, ace_max_length + 2, stdin);
if (ferror (stdin))
fail (io_error);
if (feof (stdin))
fail (invalid_input);
input_length = strlen (input) - 1;
if (input[input_length] != '\n')
fail (too_big);
input[input_length] = 0;
for (p = input; *p != 0; ++p)
{
pp = strchr (print_ascii, *p);
if (pp == 0)
fail (invalid_input);
*p = pp - print_ascii;
}
/* Decode: */
output_length = unicode_max_length;
status = punycode_decode (input_length, input, &output_length,
output, case_flags);
if (status == punycode_bad_input)
fail (invalid_input);
if (status == punycode_big_output)
fail (too_big);
if (status == punycode_overflow)
fail (overflow);
assert (status == punycode_success);
/* Output the result: */
for (j = 0; j < output_length; ++j)
{
r = printf ("%s+%04lX\n",
case_flags[j] ? "U" : "u", (unsigned long) output[j]);
if (r < 0)
fail (io_error);
}
return EXIT_SUCCESS;
}
usage (argv);
return EXIT_SUCCESS; /* not reached, but quiets compiler warning */
}
</pre>
<div class="node">
<a name="Example-3"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Example-4">Example 4</a>,
Previous: <a rel="previous" accesskey="p" href="#Example-2">Example 2</a>,
Up: <a rel="up" accesskey="u" href="#Examples">Examples</a>
</div>
<h3 class="section">9.3 Example 3</h3>
<p>This example demonstrates how the library is used to convert
internationalized domain names into ASCII compatible names.
<pre class="verbatim">/* example3.c --- Example ToASCII() code showing how to use Libidn.
* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Simon Josefsson
*
* This file is part of GNU Libidn.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h> /* setlocale() */
#include <stringprep.h> /* stringprep_locale_charset() */
#include <idna.h> /* idna_to_ascii_lz() */
/*
* Compiling using libtool and pkg-config is recommended:
*
* $ libtool cc -o example3 example3.c `pkg-config --cflags --libs libidn`
* $ ./example3
* Input domain encoded as `ISO-8859-1': www.räksmörgåsª.example
* Read string (length 23): 77 77 77 2e 72 e4 6b 73 6d f6 72 67 e5 73 aa 2e 65 78 61 6d 70 6c 65
* ACE label (length 33): 'www.xn--rksmrgsa-0zap8p.example'
* 77 77 77 2e 78 6e 2d 2d 72 6b 73 6d 72 67 73 61 2d 30 7a 61 70 38 70 2e 65 78 61 6d 70 6c 65
* $
*
*/
int
main (void)
{
char buf[BUFSIZ];
char *p;
int rc;
size_t i;
setlocale (LC_ALL, "");
printf ("Input domain encoded as `%s': ", stringprep_locale_charset ());
fflush (stdout);
fgets (buf, BUFSIZ, stdin);
buf[strlen (buf) - 1] = '\0';
printf ("Read string (length %d): ", strlen (buf));
for (i = 0; i < strlen (buf); i++)
printf ("%02x ", buf[i] & 0xFF);
printf ("\n");
rc = idna_to_ascii_lz (buf, &p, 0);
if (rc != IDNA_SUCCESS)
{
printf ("ToASCII() failed (%d): %s\n", rc, idna_strerror (rc));
return EXIT_FAILURE;
}
printf ("ACE label (length %d): '%s'\n", strlen (p), p);
for (i = 0; i < strlen (p); i++)
printf ("%02x ", p[i] & 0xFF);
printf ("\n");
free (p);
return 0;
}
</pre>
<div class="node">
<a name="Example-4"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Example-5">Example 5</a>,
Previous: <a rel="previous" accesskey="p" href="#Example-3">Example 3</a>,
Up: <a rel="up" accesskey="u" href="#Examples">Examples</a>
</div>
<h3 class="section">9.4 Example 4</h3>
<p>This example demonstrates how the library is used to convert ASCII
compatible names to internationalized domain names.
<pre class="verbatim">/* example4.c --- Example ToUnicode() code showing how to use Libidn.
* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Simon Josefsson
*
* This file is part of GNU Libidn.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h> /* setlocale() */
#include <stringprep.h> /* stringprep_locale_charset() */
#include <idna.h> /* idna_to_unicode_lzlz() */
/*
* Compiling using libtool and pkg-config is recommended:
*
* $ libtool cc -o example4 example4.c `pkg-config --cflags --libs libidn`
* $ ./example4
* Input domain encoded as `ISO-8859-1': www.xn--rksmrgsa-0zap8p.example
* Read string (length 33): 77 77 77 2e 78 6e 2d 2d 72 6b 73 6d 72 67 73 61 2d 30 7a 61 70 38 70 2e 65 78 61 6d 70 6c 65
* ACE label (length 23): 'www.räksmörgåsa.example'
* 77 77 77 2e 72 e4 6b 73 6d f6 72 67 e5 73 61 2e 65 78 61 6d 70 6c 65
* $
*
*/
int
main (void)
{
char buf[BUFSIZ];
char *p;
int rc;
size_t i;
setlocale (LC_ALL, "");
printf ("Input domain encoded as `%s': ", stringprep_locale_charset ());
fflush (stdout);
fgets (buf, BUFSIZ, stdin);
buf[strlen (buf) - 1] = '\0';
printf ("Read string (length %d): ", strlen (buf));
for (i = 0; i < strlen (buf); i++)
printf ("%02x ", buf[i] & 0xFF);
printf ("\n");
rc = idna_to_unicode_lzlz (buf, &p, 0);
if (rc != IDNA_SUCCESS)
{
printf ("ToUnicode() failed (%d): %s\n", rc, idna_strerror (rc));
return EXIT_FAILURE;
}
printf ("ACE label (length %d): '%s'\n", strlen (p), p);
for (i = 0; i < strlen (p); i++)
printf ("%02x ", p[i] & 0xFF);
printf ("\n");
free (p);
return 0;
}
</pre>
<div class="node">
<a name="Example-5"></a>
<p><hr>
Previous: <a rel="previous" accesskey="p" href="#Example-4">Example 4</a>,
Up: <a rel="up" accesskey="u" href="#Examples">Examples</a>
</div>
<h3 class="section">9.5 Example 5</h3>
<p>This example demonstrates how the library is used to check a string
for invalid characters within a specific TLD.
<pre class="verbatim">/* example5.c --- Example TLD checking.
* Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Simon
* Josefsson
*
* This file is part of GNU Libidn.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* Get stringprep_locale_charset, etc. */
#include <stringprep.h>
/* Get idna_to_ascii_8z, etc. */
#include <idna.h>
/* Get tld_check_4z. */
#include <tld.h>
/*
* Compiling using libtool and pkg-config is recommended:
*
* $ libtool cc -o example5 example5.c `pkg-config --cflags --libs libidn`
* $ ./example5
* Input domain encoded as `UTF-8': fooß.no
* Read string (length 8): 66 6f 6f c3 9f 2e 6e 6f
* ToASCII string (length 8): fooss.no
* ToUnicode string: U+0066 U+006f U+006f U+0073 U+0073 U+002e U+006e U+006f
* Domain accepted by TLD check
*
* $ ./example5
* Input domain encoded as `UTF-8': gr€€n.no
* Read string (length 12): 67 72 e2 82 ac e2 82 ac 6e 2e 6e 6f
* ToASCII string (length 16): xn--grn-l50aa.no
* ToUnicode string: U+0067 U+0072 U+20ac U+20ac U+006e U+002e U+006e U+006f
* Domain rejected by TLD check, Unicode position 2
*
*/
int
main (void)
{
char buf[BUFSIZ];
char *p;
uint32_t *r;
int rc;
size_t errpos, i;
printf ("Input domain encoded as `%s': ", stringprep_locale_charset ());
fflush (stdout);
fgets (buf, BUFSIZ, stdin);
buf[strlen (buf) - 1] = '\0';
printf ("Read string (length %d): ", strlen (buf));
for (i = 0; i < strlen (buf); i++)
printf ("%02x ", buf[i] & 0xFF);
printf ("\n");
p = stringprep_locale_to_utf8 (buf);
if (p)
{
strcpy (buf, p);
free (p);
}
else
printf ("Could not convert string to UTF-8, continuing anyway...\n");
rc = idna_to_ascii_8z (buf, &p, 0);
if (rc != IDNA_SUCCESS)
{
printf ("idna_to_ascii_8z failed (%d): %s\n", rc, idna_strerror (rc));
return 2;
}
printf ("ToASCII string (length %d): %s\n", strlen (p), p);
rc = idna_to_unicode_8z4z (p, &r, 0);
free (p);
if (rc != IDNA_SUCCESS)
{
printf ("idna_to_unicode_8z4z failed (%d): %s\n",
rc, idna_strerror (rc));
return 2;
}
printf ("ToUnicode string: ");
for (i = 0; r[i]; i++)
printf ("U+%04x ", r[i]);
printf ("\n");
rc = tld_check_4z (r, &errpos, NULL);
free (r);
if (rc == TLD_INVALID)
{
printf ("Domain rejected by TLD check, Unicode position %d\n", errpos);
return 1;
}
else if (rc != TLD_SUCCESS)
{
printf ("tld_check_4z() failed (%d): %s\n", rc, tld_strerror (rc));
return 2;
}
printf ("Domain accepted by TLD check\n");
return 0;
}
</pre>
<!-- ********************************************************** -->
<!-- ********************* Invoking idn ********************* -->
<!-- ********************************************************** -->
<div class="node">
<a name="Invoking-idn"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Emacs-API">Emacs API</a>,
Previous: <a rel="previous" accesskey="p" href="#Examples">Examples</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">10 Invoking idn</h2>
<p><a name="index-idn-113"></a><a name="index-invoking-_0040command_007bidn_007d-114"></a><a name="index-command-line-115"></a>
<h3 class="section">10.1 Name</h3>
<p>GNU Libidn (idn) – Internationalized Domain Names command line tool
<h3 class="section">10.2 Description</h3>
<p><code>idn</code> allows internationalized string preparation
(‘<samp><span class="samp">stringprep</span></samp>’), encoding and decoding of punycode data, and IDNA
ToASCII/ToUnicode operations to be performed on the command line.
<p>If strings are specified on the command line, they are used as input
and the computed output is printed to standard output <code>stdout</code>.
If no strings are specified on the command line, the program read
data, line by line, from the standard input <code>stdin</code>, and print
the computed output to standard output. What processing is performed
(e.g., ToASCII, or Punycode encode) is indicated by options. If any
errors are encountered, the execution of the applications is aborted.
<p>All strings are expected to be encoded in the preferred charset used
by your locale. Use <code>--debug</code> to find out what this charset is.
You can override the charset used by setting environment variable
<code>CHARSET</code>.
<p>To process a string that starts with <code>-</code>, for example
<code>-foo</code>, use <code>--</code> to signal the end of parameters, as in
<code>idn --quiet -a -- -foo</code>.
<h3 class="section">10.3 Options</h3>
<p><code>idn</code> recognizes these commands:
<pre class="verbatim"> -h, --help Print help and exit
-V, --version Print version and exit
-s, --stringprep Prepare string according to nameprep profile
-d, --punycode-decode Decode Punycode
-e, --punycode-encode Encode Punycode
-a, --idna-to-ascii Convert to ACE according to IDNA (default mode)
-u, --idna-to-unicode Convert from ACE according to IDNA
--allow-unassigned Toggle IDNA AllowUnassigned flag (default off)
--usestd3asciirules Toggle IDNA UseSTD3ASCIIRules flag (default off)
--no-tld Don't check string for TLD specific rules
Only for --idna-to-ascii and --idna-to-unicode
-n, --nfkc Normalize string according to Unicode v3.2 NFKC
-p, --profile=STRING Use specified stringprep profile instead
Valid stringprep profiles: `Nameprep',
`iSCSI', `Nodeprep', `Resourceprep',
`trace', `SASLprep'
--debug Print debugging information
--quiet Silent operation
</pre>
<h3 class="section">10.4 Environment Variables</h3>
<p>The <var>CHARSET</var> environment variable can be used to override what
character set to be used for decoding incoming data (i.e., on the
command line or on the standard input stream), and to encode data to
the standard output. If your system is set up correctly, however, the
application will guess which character set is used automatically.
Example usage:
<pre class="example"> $ CHARSET=ISO-8859-1 idn --punycode-encode
...
</pre>
<h3 class="section">10.5 Examples</h3>
<p>Standard usage, reading input from standard input:
<pre class="example"> jas@latte:~$ idn
libidn 0.3.5
Copyright 2002, 2003 Simon Josefsson.
GNU Libidn comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Libidn under the terms of
the GNU Lesser General Public License. For more information
about these matters, see the file named COPYING.LIB.
Type each input string on a line by itself, terminated by a newline character.
räksmörgås.se
xn--rksmrgs-5wao1o.se
jas@latte:~$
</pre>
<p>Reading input from command line, and disabling copyright and license
information:
<pre class="example"> jas@latte:~$ idn --quiet räksmörgås.se blåbærgrød.no
xn--rksmrgs-5wao1o.se
xn--blbrgrd-fxak7p.no
jas@latte:~$
</pre>
<p>Accessing a specific StringPrep profile directly:
<pre class="example"> jas@latte:~$ idn --quiet --profile=SASLprep --stringprep teßtª
teßta
jas@latte:~$
</pre>
<h3 class="section">10.6 Troubleshooting</h3>
<p>Getting character data encoded right, and making sure Libidn use the
same encoding, can be difficult. The reason for this is that most
systems encode character data in more than one character encoding,
i.e., using <code>UTF-8</code> together with <code>ISO-8859-1</code> or
<code>ISO-2022-JP</code>. This problem is likely to continue to exist until
only one character encoding come out as the evolutionary winner, or
(more likely, at least to some extents) forever.
<p>The first step to troubleshooting character encoding problems with
Libidn is to use the ‘<samp><span class="samp">--debug</span></samp>’ parameter to find out which
character set encoding ‘<samp><span class="samp">idn</span></samp>’ believe your locale uses.
<pre class="example"> jas@latte:~$ idn --debug --quiet ""
system locale uses charset `UTF-8'.
jas@latte:~$
</pre>
<p>If it prints <code>ANSI_X3.4-1968</code> (i.e., <code>US-ASCII</code>), this
indicate you have not configured your locale properly. To configure
the locale, you can, for example, use ‘<samp><span class="samp">LANG=sv_SE.UTF-8; export
LANG</span></samp>’ at a <code>/bin/sh</code> prompt, to set up your locale for a Swedish
environment using <code>UTF-8</code> as the encoding.
<p>Sometimes ‘<samp><span class="samp">idn</span></samp>’ appear to be unable to translate from your system
locale into <code>UTF-8</code> (which is used internally), and you get an
error like the following:
<pre class="example"> jas@latte:~$ idn --quiet foo
idn: could not convert from ISO-8859-1 to UTF-8.
jas@latte:~$
</pre>
<p>The simplest explanation is that you haven't installed the
‘<samp><span class="samp">iconv</span></samp>’ conversion tools. You can find it as a standalone
library in <acronym>GNU</acronym> Libiconv
(<a href="http://www.gnu.org/software/libiconv/">http://www.gnu.org/software/libiconv/</a>). On many
<acronym>GNU</acronym>/Linux systems, this library is part of the system, but
you may have to install additional packages (e.g., ‘<samp><span class="samp">glibc-locale</span></samp>’
for Debian) to be able to use it.
<p>Another explanation is that the error is correct and you are feeding
‘<samp><span class="samp">idn</span></samp>’ invalid data. This can happen inadvertently if you are not
careful with the character set encodings you use. For example, if
your shell run in a <code>ISO-8859-1</code> environment, and you invoke
‘<samp><span class="samp">idn</span></samp>’ with the ‘<samp><span class="samp">CHARSET</span></samp>’ environment variable as follows,
you will feed it <code>ISO-8859-1</code> characters but force it to believe
they are <code>UTF-8</code>. Naturally this will lead to an error, unless
the byte sequences happen to be parsable as <code>UTF-8</code>. Note that
even if you don't get an error, the output may be incorrect in this
situation, because <code>ISO-8859-1</code> and <code>UTF-8</code> does not in
general encode the same characters as the same byte sequences.
<pre class="example"> jas@latte:~$ idn --quiet --debug ""
system locale uses charset `ISO-8859-1'.
jas@latte:~$ CHARSET=UTF-8 idn --quiet --debug räksmörgås
system locale uses charset `UTF-8'.
input[0] = U+0072
input[1] = U+4af3
input[2] = U+006d
input[3] = U+1b29e5
input[4] = U+0073
output[0] = U+0078
output[1] = U+006e
output[2] = U+002d
output[3] = U+002d
output[4] = U+0072
output[5] = U+006d
output[6] = U+0073
output[7] = U+002d
output[8] = U+0068
output[9] = U+0069
output[10] = U+0036
output[11] = U+0064
output[12] = U+0035
output[13] = U+0039
output[14] = U+0037
output[15] = U+0035
output[16] = U+0035
output[17] = U+0032
output[18] = U+0061
xn--rms-hi6d597552a
jas@latte:~$
</pre>
<p>The sense moral here is to forget about ‘<samp><span class="samp">CHARSET</span></samp>’ (configure your
locales properly instead) unless you know what you are doing, and if
you want to use it, do it carefully, after verifying with
‘<samp><span class="samp">--debug</span></samp>’ that you get the desired results.
<div class="node">
<a name="Emacs-API"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Java-API">Java API</a>,
Previous: <a rel="previous" accesskey="p" href="#Invoking-idn">Invoking idn</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">11 Emacs API</h2>
<p>Included in Libidn are <samp><span class="file">punycode.el</span></samp> and <samp><span class="file">idna.el</span></samp> that
provides an Emacs Lisp API to (a limited set of) the Libidn API. This
section describes the API. Currently the IDNA API always set the
<code>UseSTD3ASCIIRules</code> flag and clear the <code>AllowUnassigned</code>
flag, in the future there may be functionality to specify these flags
via the API.
<h3 class="section">11.1 Punycode Emacs API</h3>
<div class="defun">
— Variable: <b>punycode-program</b><var><a name="index-punycode_002dprogram-116"></a></var><br>
<blockquote><p>Name of the GNU Libidn <samp><span class="file">idn</span></samp> application. The default is
‘<samp><span class="samp">idn</span></samp>’. This variable can be customized.
</p></blockquote></div>
<div class="defun">
— Variable: <b>punycode-environment</b><var><a name="index-punycode_002denvironment-117"></a></var><br>
<blockquote><p>List of environment variable definitions prepended to
‘<samp><span class="samp">process-environment</span></samp>’. The default is ‘<samp><span class="samp">("CHARSET=UTF-8")</span></samp>’.
This variable can be customized.
</p></blockquote></div>
<div class="defun">
— Variable: <b>punycode-encode-parameters</b><var><a name="index-punycode_002dencode_002dparameters-118"></a></var><br>
<blockquote><p>List of parameters passed to <var>punycode-program</var> to invoke punycode
encoding mode. The default is ‘<samp><span class="samp">("--quiet" "--punycode-encode")</span></samp>’.
This variable can be customized.
</p></blockquote></div>
<div class="defun">
— Variable: <b>punycode-decode-parameters</b><var><a name="index-punycode_002ddecode_002dparameters-119"></a></var><br>
<blockquote><p>Parameters passed to <var>punycode-program</var> to invoke punycode
decoding mode. The default is ‘<samp><span class="samp">("--quiet" "--punycode-decode")</span></samp>’.
This variable can be customized.
</p></blockquote></div>
<div class="defun">
— Function: <b>punycode-encode</b><var> string<a name="index-punycode_002dencode-120"></a></var><br>
<blockquote><p>Returns a Punycode encoding of the <var>string</var>, after converting the
input into UTF-8.
</p></blockquote></div>
<div class="defun">
— Function: <b>punycode-decode</b><var> string<a name="index-punycode_002ddecode-121"></a></var><br>
<blockquote><p>Returns a possibly multibyte string which is the decoding of the
<var>string</var> which is a punycode encoded string.
</p></blockquote></div>
<h3 class="section">11.2 IDNA Emacs API</h3>
<div class="defun">
— Variable: <b>idna-program</b><var><a name="index-idna_002dprogram-122"></a></var><br>
<blockquote><p>Name of the GNU Libidn <samp><span class="file">idn</span></samp> application. The default is
‘<samp><span class="samp">idn</span></samp>’. This variable can be customized.
</p></blockquote></div>
<div class="defun">
— Variable: <b>idna-environment</b><var><a name="index-idna_002denvironment-123"></a></var><br>
<blockquote><p>List of environment variable definitions prepended to
‘<samp><span class="samp">process-environment</span></samp>’. The default is ‘<samp><span class="samp">("CHARSET=UTF-8")</span></samp>’.
This variable can be customized.
</p></blockquote></div>
<div class="defun">
— Variable: <b>idna-to-ascii-parameters</b><var><a name="index-idna_002dto_002dascii_002dparameters-124"></a></var><br>
<blockquote><p>List of parameters passed to <var>idna-program</var> to invoke IDNA ToASCII
mode. The default is ‘<samp><span class="samp">("--quiet" "--idna-to-ascii"
"--usestd3asciirules")</span></samp>’. This variable can be customized.
</p></blockquote></div>
<div class="defun">
— Variable: <b>idna-to-unicode-parameters</b><var><a name="index-idna_002dto_002dunicode_002dparameters-125"></a></var><br>
<blockquote><p>Parameters passed <var>idna-program</var> to invoke IDNA ToUnicode mode.
The default is ‘<samp><span class="samp">("--quiet" "--idna-to-unicode"
"--usestd3asciirules")</span></samp>’. This variable can be customized.
</p></blockquote></div>
<div class="defun">
— Function: <b>idna-to-ascii</b><var> string<a name="index-idna_002dto_002dascii-126"></a></var><br>
<blockquote><p>Returns an ASCII Compatible Encoding (ACE) of the string computed by
the IDNA ToASCII operation on the input <var>string</var>, after converting
the input to UTF-8.
</p></blockquote></div>
<div class="defun">
— Function: <b>idna-to-unicode</b><var> string<a name="index-idna_002dto_002dunicode-127"></a></var><br>
<blockquote><p>Returns a possibly multibyte string which is the output of the IDNA
ToUnicode operation computed on the input <var>string</var>.
</p></blockquote></div>
<div class="node">
<a name="Java-API"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#C_0023-API">C# API</a>,
Previous: <a rel="previous" accesskey="p" href="#Emacs-API">Emacs API</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">12 Java API</h2>
<p>Libidn has been ported to the Java programming language, and as a
consequence most of the API is available to native Java applications.
This section contain notes on this support, complete documentation is
pending.
<p>The Java library, if Libidn has been built with Java support
(see <a href="#Downloading-and-Installing">Downloading and Installing</a>), will be placed in
<samp><span class="file">java/libidn-1.18.jar</span></samp>. The source code is located in
<samp><span class="file">java/gnu/inet/encoding/</span></samp>.
<h3 class="section">12.1 Overview</h3>
<p>This package provides a Java implementation of the Internationalized
Domain Names in Applications (IDNA) standard. It is written entirely
in Java and does not require any additional libraries to be set up.
<p>The gnu.inet.encoding.IDNA class offers two public functions, toASCII
and toUnicode which can be used as follows:
<pre class="example"> gnu.inet.encoding.IDNA.toASCII("blöds.züg");
gnu.inet.encoding.IDNA.toUnicode("xn--blds-6qa.xn--zg-xka");
</pre>
<h3 class="section">12.2 Miscellaneous Programs</h3>
<p>The <samp><span class="file">misc/</span></samp> directory contains several programs that are related
to the Java part of GNU Libidn, but that don't need to be included in
the main source tree.
<h4 class="subsection">12.2.1 GenerateRFC3454</h4>
<p>This program parses RFC3454 and creates the RFC3454.java program that
is required during the StringPrep phase.
<p>The RFC can be found at various locations, for example at
<a href="http://www.ietf.org/rfc/rfc3454.txt">http://www.ietf.org/rfc/rfc3454.txt</a>.
<p>Invoke the program as follows:
<pre class="example"> $ java GenerateRFC3454
Creating RFC3454.java... Ok.
</pre>
<h4 class="subsection">12.2.2 GenerateNFKC</h4>
<p>The GenerateNFKC program parses the Unicode character database file
and generates all the tables required for NFKC. This program requires
the two files UnicodeData.txt and CompositionExclusions.txt of version
3.2 of the Unicode files. Note that RFC3454 (Stringprep) defines that
Unicode version 3.2 is to be used, not the latest version.
<p>The Unicode data files can be found at
<a href="http://www.unicode.org/Public/">http://www.unicode.org/Public/</a>.
<p>Invoke the program as follows:
<pre class="example"> $ java GenerateNFKC
Creating CombiningClass.java... Ok.
Creating DecompositionKeys.java... Ok.
Creating DecompositionMappings.java... Ok.
Creating Composition.java... Ok.
</pre>
<h4 class="subsection">12.2.3 TestIDNA</h4>
<p>The TestIDNA program allows to test the IDNA implementation manually
or against Simon Josefsson's test vectors.
<p>The test vectors can be found at the Libidn homepage,
<a href="http://www.gnu.org/software/libidn/">http://www.gnu.org/software/libidn/</a>.
<p>To test the tranformation manually, use:
<pre class="example"> $ java -cp .:../libidn.jar TestIDNA -a <string to test>
Input: <string to test>
Output: <toASCII(string to test)>
$ java -cp .:../libidn.jar TestIDNA -u <string to test>
Input: <string to test>
Output: <toUnicode(string to test)>
</pre>
<p>To test against draft-josefsson-idn-test-vectors.html, use:
<pre class="example"> $ java -cp .:../libidn.jar TestIDNA -t
No errors detected!
</pre>
<h4 class="subsection">12.2.4 TestNFKC</h4>
<p>The TestNFKC program allows to test the NFKC implementation manually
or against the NormalizationTest.txt file from the Unicode data files.
<p>To test the normalization manually, use:
<pre class="example"> $ java -cp .:../libidn.jar TestNFKC <string to test>
Input: <string to test>
Output: <nfkc version of the string to test>
</pre>
<p>To test against NormalizationTest.txt:
<pre class="example"> $ java -cp .:../libidn.jar TestNFKC
No errors detected!
</pre>
<h3 class="section">12.3 Possible Problems</h3>
<p>Beware of Bugs: This Java API needs a lot more testing, especially
with "exotic" character sets. While it works for me, it may not work
for you.
<p>Encoding of your Java sources: If you are using non-ASCII characters
in your Java source code, make sure javac compiles your programs with
the correct encoding. If necessary specify the encoding using the
-encoding parameter.
<p>Java Unicode handling: Java 1.4 only handles 16-bit Unicode code
points (i.e. characters in the Basic Multilingual Plane), this
implementation therefore ignores all references to so-called
Supplementary Characters (U+10000 to U+10FFFF). Starting from Java
1.5, these characters will also be supported by Java, but this will
require changes to this library. See also the next section.
<h3 class="section">12.4 A Note on Java and Unicode</h3>
<p>This library uses Java's builtin 'char' datatype. Up to Java 1.4, this
datatype only supports 16-bit Unicode code points, also called the
Basic Multilingual Plane. For this reason, this library doesn't work
for Supplementary Characters (i.e. characters from U+10000 to
U+10FFFF). All references to such characters are silently ignored.
<p>Starting from Java 1.5, also Supplementary Characters will be
supported. However, this will require changes in the present version
of the library. Java 1.5 is currently in beta status.
<p>For more information refer to the documentation of java.lang.Character
in the JDK API.
<div class="node">
<a name="C%23-API"></a>
<a name="C_0023-API"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Acknowledgements">Acknowledgements</a>,
Previous: <a rel="previous" accesskey="p" href="#Java-API">Java API</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">13 C# API</h2>
<p>The Libidn library has been ported to the C# language. The port
reside in the top-level <samp><span class="file">csharp/</span></samp> directory. Currently, no
further documentation about the implementation or the API is
available. However, the C# port was based on the Java port, and the
API is exactly the same as in the Java version. The help files for
the Java API may thus be useful.
<!-- ********************************************************** -->
<!-- ******************* Acknowledgements ******************* -->
<!-- ********************************************************** -->
<div class="node">
<a name="Acknowledgements"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#History">History</a>,
Previous: <a rel="previous" accesskey="p" href="#C_0023-API">C# API</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">14 Acknowledgements</h2>
<p>The punycode implementation was taken from the IETF IDN Punycode
specification, by Adam M. Costello. The TLD code was contributed by
Thomas Jacob. The Java implementation was contributed by Oliver Hitz.
The C# implementation was contributed by Alexander Gnauck. The
Unicode tables were provided by Unicode, Inc. Some functions for
dealing with Unicode (see nfkc.c and toutf8.c) were borrowed from
GLib, downloaded from <a href="http://www.gtk.org/">http://www.gtk.org/</a>. The manual borrowed
text from Libgcrypt by Werner Koch.
<p>Inspiration for many things that, consciously or not, have gone into
this package is due to a number of free software package that the
author has been exposed to. The author wishes to acknowledge the free
software community in general, for giving an example on what role
software development can play in the modern society.
<p>Several people reported bugs, sent patches or suggested improvements,
see the file THANKS in the top-level directory of the source code.
<!-- ********************************************************** -->
<!-- ************************ History *********************** -->
<!-- ********************************************************** -->
<div class="node">
<a name="History"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#PR29-discussion">PR29 discussion</a>,
Previous: <a rel="previous" accesskey="p" href="#Acknowledgements">Acknowledgements</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">15 History</h2>
<p>The complete history of user visible changes is stored in the file
<samp><span class="file">NEWS</span></samp> in the top-level directory of the source code tree. The
complete history of modifications to each file is stored in the file
<samp><span class="file">ChangeLog</span></samp> in the same directory. This section contain a
condensed version of that information, in the form of “milestones”
for the project.
<dl>
<dt>Stringprep implementation.<dd>Version 0.0.0 released on 2002-11-05.
<br><dt>IDNA and Punycode implementations, part of the GNU project.<dd>Version 0.1.0 released on 2003-01-05.
<br><dt>Uses official IDNA ACE prefix <code>xn--</code>.<dd>Version 0.1.7 released on 2003-02-12.
<br><dt>Command line interface.<dd>Version 0.1.11 released on 2003-02-26.
<br><dt>GNU Libc add-on proposed.<dd>Version 0.1.12 released on 2003-03-06.
<br><dt>Interoperability testing during IDNConnect.<dd>Version 0.3.1 released on 2003-10-02.
<br><dt>TLD restriction testing.<dd>Version 0.4.0 released on 2004-02-28.
<br><dt>GNU Libc add-on integrated.<dd>Version 0.4.1 released on 2004-03-08.
<br><dt>Native Java implementation.<dd>Version 0.4.2-0.4.9 released between 2004-03-20 and 2004-06-11.
<br><dt>PR-29 functions for “problem sequences”.<dd>Version 0.5.0 released on 2004-06-26.
<br><dt>Many small portability fixes and wider use.<dd>Version 0.5.1 through 0.5.20, released between 2004-07-09 and
2005-10-23.
<br><dt>Native C# implementation.<dd>Version 0.6.0 released on 2005-12-03.
<br><dt>Windows support through cross-compilation.<dd>Version 0.6.1 released on 2006-01-20.
<br><dt>Library declared stable by releasing v1.0.<dd>Version 1.0 released on 2007-07-31.
</dl>
<div class="node">
<a name="PR29-discussion"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#On-Label-Separators">On Label Separators</a>,
Previous: <a rel="previous" accesskey="p" href="#History">History</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="appendix">Appendix A PR29 discussion</h2>
<p>If you wish to experiment with a modified Unicode NFKC implementation
according to the PR29 proposal, you may find the following bug report
useful. However, I have not verified that the suggested modifications
are correct. For reference, I'm including my response to the report
as well.
<pre class="verbatim">From: Rick McGowan <rick@unicode.org>
Subject: Possible bug and status of PR 29 change(s)
To: bug-libidn@gnu.org
Date: Wed, 27 Oct 2004 14:49:17 -0700
Hello. On behalf of the Unicode Consortium editorial committee, I would
like to find out more information about the PR 29 fixes, if any, and
functions in Libidn. Your implementation was listed in the text of PR29 as
needing investigation, so I am following up on several implementations.
The UTC has accepted the proposed fix to D2 as outlined in PR29, and a new
draft of UAX #15 has been issued.
I have looked at Libidn 0.5.8 (today), and there may still be a possible
bug in NFKC.java and nfkc.c.
------------------------------------------------------
1. In NFKC.java, this line in canonicalOrdering():
if (i > 0 && (last_cc == 0 || last_cc != cc)) {
should perhaps be changed to:
if (i > 0 && (last_cc == 0 || last_cc < cc)) {
but I'm not sure of the sense of this comparison.
------------------------------------------------------
2. In nfkc.c, function _g_utf8_normalize_wc() has this code:
if (i > 0 &&
(last_cc == 0 || last_cc != cc) &&
combine (wc_buffer[last_start], wc_buffer[i],
&wc_buffer[last_start]))
{
This appears to have the same bug as the current Python implementation (in
Python 2.3.4). The code should be checking, as per new rule D2 UAX #15
update, that the next combining character is the same or HIGHER than the
current one. It now checks to see if it's non-zero and not equal.
The above line(s) should perhaps be changed to:
if (i > 0 &&
(last_cc == 0 || last_cc < cc) &&
combine (wc_buffer[last_start], wc_buffer[i],
&wc_buffer[last_start]))
{
but I'm not sure of the sense of the comparison (< or > or <=?) here.
In the text of PR29, I will be marking Libidn as "needs change" and adding
the version number that I checked. If any further change is made, please
let me know the release version, and I'll update again.
Regards,
Rick McGowan
</pre>
<pre class="verbatim">From: Simon Josefsson <jas@extundo.com>
Subject: Re: Possible bug and status of PR 29 change(s)
To: Rick McGowan <rick@unicode.org>
Cc: bug-libidn@gnu.org
Date: Thu, 28 Oct 2004 09:47:47 +0200
Rick McGowan <rick@unicode.org> writes:
> Hello. On behalf of the Unicode Consortium editorial committee, I would
> like to find out more information about the PR 29 fixes, if any, and
> functions in Libidn. Your implementation was listed in the text of PR29 as
> needing investigation, so I am following up on several implementations.
>
> The UTC has accepted the proposed fix to D2 as outlined in PR29, and a new
> draft of UAX #15 has been issued.
>
> I have looked at Libidn 0.5.8 (today), and there may still be a possible
> bug in NFKC.java and nfkc.c.
Hello Rick.
I believe the current behavior is intentional. Libidn do not aim to
implement latest-and-greatest NFKC, it aim to implement the NFKC
functionality required for StringPrep and IDN. As you may know,
StringPrep/IDN reference Unicode 3.2.0, and explicitly says any later
changes (which I consider PR29 as) do not apply.
In fact, I believe that would I incorporate the changes suggested in
PR29, I would in fact be violating the IDN specifications.
Thanks for looking into the code and finding the place where the
change could be made. I'll see if I can mention this in the manual
somewhere, for technically interested readers.
Regards,
Simon
</pre>
<div class="node">
<a name="On-Label-Separators"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Copying-Information">Copying Information</a>,
Previous: <a rel="previous" accesskey="p" href="#PR29-discussion">PR29 discussion</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="appendix">Appendix B On Label Separators</h2>
<p>Some strings contains characters whose NFKC normalized form contain
the ASCII dot (0x2E, “.”). Examples of these characters are U+2024
(ONE DOT LEADER) and U+248C (DIGIT FIVE FULL STOP). The strings have
the interesting property that their IDNA ToASCII output will contain
embedded dots. For example:
<pre class="example"> ToASCII (hi U+248C com) = hi5.com
ToASCII (räksmörgås U+2024 com) = xn--rksmrgs.com-l8as9u
</pre>
<p>This demonstrate the two general cases: The first where the ASCII dot
is part of an output that do not begin with the IDN prefix
<code>xn--</code>. The second example illustrate when the dot is part of
IDN prefixed with <code>xn--</code>.
<p>The input strings are, from the DNS point of view, a single label.
The IDNA algorithm translate one label at a time. Thus, the output is
expected to be only one label. What is important here is to make sure
the DNS resolver receives the correct query. The DNS protocol does
not use the dot to delimit labels on the wire, rather it uses
length-value pairs. Thus the correct query would be for
<code>{7}hi5.com</code> and <code>{22}xn--rksmrgs.com-l8as9u</code>
respectively.
<p>Some implementations <a rel="footnote" href="#fn-1" name="fnd-1"><sup>1</sup></a> have decided that
these inputs strings are potentially confusing for the user. The
string <code>hi U+248C com</code> looks like <code>hi5.com</code> on systems that
support Unicode properly. These implementations do not follow RFC
3490. They yield:
<pre class="example"> ToASCII (hi U+248C com) = hi5.com
ToASCII (räksmörgås U+2024 com) = xn--rksmrgs-5wao1o.com
</pre>
<p>The DNS query they perform are <code>{3}hi5{3}com</code> and
<code>{18}xn--rksmrgs-5wao1o{3}com</code> respectively. Arguably, this
leads to a better user experience, and suggests that the IDNA
specification is sub-optimal in this area.
<h3 class="section">B.1 Recommended Workaround</h3>
<p>It has been suggested to normalize the entire input string using NFKC
before passing it to IDNA ToASCII. You may use
<code>stringprep_utf8_nfkc_normalize</code> or
<code>stringprep_ucs4_nfkc_normalize</code>. This appears to lead to
similar behaviour as IE/Firefox, which would avoid the problem, but
this needs to be confirmed. Feel free to discuss the issue with us.
<p>Alternative workarounds are being considered. Eventually Libidn may
implement a new flag to the <code>idna_*</code> functions that implements a
recommended way to work around this problem.
<div class="node">
<a name="Copying-Information"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Function-and-Variable-Index">Function and Variable Index</a>,
Previous: <a rel="previous" accesskey="p" href="#On-Label-Separators">On Label Separators</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="appendix">Appendix C Copying Information</h2>
<ul class="menu">
<li><a accesskey="1" href="#GNU-Free-Documentation-License">GNU Free Documentation License</a>: License for copying this manual.
<li><a accesskey="2" href="#GNU-LGPL">GNU LGPL</a>: License for copying the library.
<li><a accesskey="3" href="#GNU-GPL">GNU GPL</a>: License for copying the programs.
</ul>
<div class="node">
<a name="GNU-Free-Documentation-License"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#GNU-LGPL">GNU LGPL</a>,
Up: <a rel="up" accesskey="u" href="#Copying-Information">Copying Information</a>
</div>
<h3 class="appendixsec">C.1 GNU Free Documentation License</h3>
<p><a name="index-FDL_002c-GNU-Free-Documentation-License-128"></a>
<!-- The GNU Free Documentation License. -->
<div align="center">Version 1.3, 3 November 2008</div>
<!-- This file is intended to be included within another document, -->
<!-- hence no sectioning command or @node. -->
<pre class="display"> Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
<a href="http://fsf.org/">http://fsf.org/</a>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
</pre>
<ol type=1 start=0>
<li>PREAMBLE
<p>The purpose of this License is to make a manual, textbook, or other
functional and useful document <dfn>free</dfn> in the sense of freedom: to
assure everyone the effective freedom to copy and redistribute it,
with or without modifying it, either commercially or noncommercially.
Secondarily, this License preserves for the author and publisher a way
to get credit for their work, while not being considered responsible
for modifications made by others.
<p>This License is a kind of “copyleft”, which means that derivative
works of the document must themselves be free in the same sense. It
complements the GNU General Public License, which is a copyleft
license designed for free software.
<p>We have designed this License in order to use it for manuals for free
software, because free software needs free documentation: a free
program should come with manuals providing the same freedoms that the
software does. But this License is not limited to software manuals;
it can be used for any textual work, regardless of subject matter or
whether it is published as a printed book. We recommend this License
principally for works whose purpose is instruction or reference.
<li>APPLICABILITY AND DEFINITIONS
<p>This License applies to any manual or other work, in any medium, that
contains a notice placed by the copyright holder saying it can be
distributed under the terms of this License. Such a notice grants a
world-wide, royalty-free license, unlimited in duration, to use that
work under the conditions stated herein. The “Document”, below,
refers to any such manual or work. Any member of the public is a
licensee, and is addressed as “you”. You accept the license if you
copy, modify or distribute the work in a way requiring permission
under copyright law.
<p>A “Modified Version” of the Document means any work containing the
Document or a portion of it, either copied verbatim, or with
modifications and/or translated into another language.
<p>A “Secondary Section” is a named appendix or a front-matter section
of the Document that deals exclusively with the relationship of the
publishers or authors of the Document to the Document's overall
subject (or to related matters) and contains nothing that could fall
directly within that overall subject. (Thus, if the Document is in
part a textbook of mathematics, a Secondary Section may not explain
any mathematics.) The relationship could be a matter of historical
connection with the subject or with related matters, or of legal,
commercial, philosophical, ethical or political position regarding
them.
<p>The “Invariant Sections” are certain Secondary Sections whose titles
are designated, as being those of Invariant Sections, in the notice
that says that the Document is released under this License. If a
section does not fit the above definition of Secondary then it is not
allowed to be designated as Invariant. The Document may contain zero
Invariant Sections. If the Document does not identify any Invariant
Sections then there are none.
<p>The “Cover Texts” are certain short passages of text that are listed,
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
the Document is released under this License. A Front-Cover Text may
be at most 5 words, and a Back-Cover Text may be at most 25 words.
<p>A “Transparent” copy of the Document means a machine-readable copy,
represented in a format whose specification is available to the
general public, that is suitable for revising the document
straightforwardly with generic text editors or (for images composed of
pixels) generic paint programs or (for drawings) some widely available
drawing editor, and that is suitable for input to text formatters or
for automatic translation to a variety of formats suitable for input
to text formatters. A copy made in an otherwise Transparent file
format whose markup, or absence of markup, has been arranged to thwart
or discourage subsequent modification by readers is not Transparent.
An image format is not Transparent if used for any substantial amount
of text. A copy that is not “Transparent” is called “Opaque”.
<p>Examples of suitable formats for Transparent copies include plain
<span class="sc">ascii</span> without markup, Texinfo input format, LaTeX input
format, <acronym>SGML</acronym> or <acronym>XML</acronym> using a publicly available
<acronym>DTD</acronym>, and standard-conforming simple <acronym>HTML</acronym>,
PostScript or <acronym>PDF</acronym> designed for human modification. Examples
of transparent image formats include <acronym>PNG</acronym>, <acronym>XCF</acronym> and
<acronym>JPG</acronym>. Opaque formats include proprietary formats that can be
read and edited only by proprietary word processors, <acronym>SGML</acronym> or
<acronym>XML</acronym> for which the <acronym>DTD</acronym> and/or processing tools are
not generally available, and the machine-generated <acronym>HTML</acronym>,
PostScript or <acronym>PDF</acronym> produced by some word processors for
output purposes only.
<p>The “Title Page” means, for a printed book, the title page itself,
plus such following pages as are needed to hold, legibly, the material
this License requires to appear in the title page. For works in
formats which do not have any title page as such, “Title Page” means
the text near the most prominent appearance of the work's title,
preceding the beginning of the body of the text.
<p>The “publisher” means any person or entity that distributes copies
of the Document to the public.
<p>A section “Entitled XYZ” means a named subunit of the Document whose
title either is precisely XYZ or contains XYZ in parentheses following
text that translates XYZ in another language. (Here XYZ stands for a
specific section name mentioned below, such as “Acknowledgements”,
“Dedications”, “Endorsements”, or “History”.) To “Preserve the Title”
of such a section when you modify the Document means that it remains a
section “Entitled XYZ” according to this definition.
<p>The Document may include Warranty Disclaimers next to the notice which
states that this License applies to the Document. These Warranty
Disclaimers are considered to be included by reference in this
License, but only as regards disclaiming warranties: any other
implication that these Warranty Disclaimers may have is void and has
no effect on the meaning of this License.
<li>VERBATIM COPYING
<p>You may copy and distribute the Document in any medium, either
commercially or noncommercially, provided that this License, the
copyright notices, and the license notice saying this License applies
to the Document are reproduced in all copies, and that you add no other
conditions whatsoever to those of this License. You may not use
technical measures to obstruct or control the reading or further
copying of the copies you make or distribute. However, you may accept
compensation in exchange for copies. If you distribute a large enough
number of copies you must also follow the conditions in section 3.
<p>You may also lend copies, under the same conditions stated above, and
you may publicly display copies.
<li>COPYING IN QUANTITY
<p>If you publish printed copies (or copies in media that commonly have
printed covers) of the Document, numbering more than 100, and the
Document's license notice requires Cover Texts, you must enclose the
copies in covers that carry, clearly and legibly, all these Cover
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
the back cover. Both covers must also clearly and legibly identify
you as the publisher of these copies. The front cover must present
the full title with all words of the title equally prominent and
visible. You may add other material on the covers in addition.
Copying with changes limited to the covers, as long as they preserve
the title of the Document and satisfy these conditions, can be treated
as verbatim copying in other respects.
<p>If the required texts for either cover are too voluminous to fit
legibly, you should put the first ones listed (as many as fit
reasonably) on the actual cover, and continue the rest onto adjacent
pages.
<p>If you publish or distribute Opaque copies of the Document numbering
more than 100, you must either include a machine-readable Transparent
copy along with each Opaque copy, or state in or with each Opaque copy
a computer-network location from which the general network-using
public has access to download using public-standard network protocols
a complete Transparent copy of the Document, free of added material.
If you use the latter option, you must take reasonably prudent steps,
when you begin distribution of Opaque copies in quantity, to ensure
that this Transparent copy will remain thus accessible at the stated
location until at least one year after the last time you distribute an
Opaque copy (directly or through your agents or retailers) of that
edition to the public.
<p>It is requested, but not required, that you contact the authors of the
Document well before redistributing any large number of copies, to give
them a chance to provide you with an updated version of the Document.
<li>MODIFICATIONS
<p>You may copy and distribute a Modified Version of the Document under
the conditions of sections 2 and 3 above, provided that you release
the Modified Version under precisely this License, with the Modified
Version filling the role of the Document, thus licensing distribution
and modification of the Modified Version to whoever possesses a copy
of it. In addition, you must do these things in the Modified Version:
<ol type=A start=1>
<li>Use in the Title Page (and on the covers, if any) a title distinct
from that of the Document, and from those of previous versions
(which should, if there were any, be listed in the History section
of the Document). You may use the same title as a previous version
if the original publisher of that version gives permission.
<li>List on the Title Page, as authors, one or more persons or entities
responsible for authorship of the modifications in the Modified
Version, together with at least five of the principal authors of the
Document (all of its principal authors, if it has fewer than five),
unless they release you from this requirement.
<li>State on the Title page the name of the publisher of the
Modified Version, as the publisher.
<li>Preserve all the copyright notices of the Document.
<li>Add an appropriate copyright notice for your modifications
adjacent to the other copyright notices.
<li>Include, immediately after the copyright notices, a license notice
giving the public permission to use the Modified Version under the
terms of this License, in the form shown in the Addendum below.
<li>Preserve in that license notice the full lists of Invariant Sections
and required Cover Texts given in the Document's license notice.
<li>Include an unaltered copy of this License.
<li>Preserve the section Entitled “History”, Preserve its Title, and add
to it an item stating at least the title, year, new authors, and
publisher of the Modified Version as given on the Title Page. If
there is no section Entitled “History” in the Document, create one
stating the title, year, authors, and publisher of the Document as
given on its Title Page, then add an item describing the Modified
Version as stated in the previous sentence.
<li>Preserve the network location, if any, given in the Document for
public access to a Transparent copy of the Document, and likewise
the network locations given in the Document for previous versions
it was based on. These may be placed in the “History” section.
You may omit a network location for a work that was published at
least four years before the Document itself, or if the original
publisher of the version it refers to gives permission.
<li>For any section Entitled “Acknowledgements” or “Dedications”, Preserve
the Title of the section, and preserve in the section all the
substance and tone of each of the contributor acknowledgements and/or
dedications given therein.
<li>Preserve all the Invariant Sections of the Document,
unaltered in their text and in their titles. Section numbers
or the equivalent are not considered part of the section titles.
<li>Delete any section Entitled “Endorsements”. Such a section
may not be included in the Modified Version.
<li>Do not retitle any existing section to be Entitled “Endorsements” or
to conflict in title with any Invariant Section.
<li>Preserve any Warranty Disclaimers.
</ol>
<p>If the Modified Version includes new front-matter sections or
appendices that qualify as Secondary Sections and contain no material
copied from the Document, you may at your option designate some or all
of these sections as invariant. To do this, add their titles to the
list of Invariant Sections in the Modified Version's license notice.
These titles must be distinct from any other section titles.
<p>You may add a section Entitled “Endorsements”, provided it contains
nothing but endorsements of your Modified Version by various
parties—for example, statements of peer review or that the text has
been approved by an organization as the authoritative definition of a
standard.
<p>You may add a passage of up to five words as a Front-Cover Text, and a
passage of up to 25 words as a Back-Cover Text, to the end of the list
of Cover Texts in the Modified Version. Only one passage of
Front-Cover Text and one of Back-Cover Text may be added by (or
through arrangements made by) any one entity. If the Document already
includes a cover text for the same cover, previously added by you or
by arrangement made by the same entity you are acting on behalf of,
you may not add another; but you may replace the old one, on explicit
permission from the previous publisher that added the old one.
<p>The author(s) and publisher(s) of the Document do not by this License
give permission to use their names for publicity for or to assert or
imply endorsement of any Modified Version.
<li>COMBINING DOCUMENTS
<p>You may combine the Document with other documents released under this
License, under the terms defined in section 4 above for modified
versions, provided that you include in the combination all of the
Invariant Sections of all of the original documents, unmodified, and
list them all as Invariant Sections of your combined work in its
license notice, and that you preserve all their Warranty Disclaimers.
<p>The combined work need only contain one copy of this License, and
multiple identical Invariant Sections may be replaced with a single
copy. If there are multiple Invariant Sections with the same name but
different contents, make the title of each such section unique by
adding at the end of it, in parentheses, the name of the original
author or publisher of that section if known, or else a unique number.
Make the same adjustment to the section titles in the list of
Invariant Sections in the license notice of the combined work.
<p>In the combination, you must combine any sections Entitled “History”
in the various original documents, forming one section Entitled
“History”; likewise combine any sections Entitled “Acknowledgements”,
and any sections Entitled “Dedications”. You must delete all
sections Entitled “Endorsements.”
<li>COLLECTIONS OF DOCUMENTS
<p>You may make a collection consisting of the Document and other documents
released under this License, and replace the individual copies of this
License in the various documents with a single copy that is included in
the collection, provided that you follow the rules of this License for
verbatim copying of each of the documents in all other respects.
<p>You may extract a single document from such a collection, and distribute
it individually under this License, provided you insert a copy of this
License into the extracted document, and follow this License in all
other respects regarding verbatim copying of that document.
<li>AGGREGATION WITH INDEPENDENT WORKS
<p>A compilation of the Document or its derivatives with other separate
and independent documents or works, in or on a volume of a storage or
distribution medium, is called an “aggregate” if the copyright
resulting from the compilation is not used to limit the legal rights
of the compilation's users beyond what the individual works permit.
When the Document is included in an aggregate, this License does not
apply to the other works in the aggregate which are not themselves
derivative works of the Document.
<p>If the Cover Text requirement of section 3 is applicable to these
copies of the Document, then if the Document is less than one half of
the entire aggregate, the Document's Cover Texts may be placed on
covers that bracket the Document within the aggregate, or the
electronic equivalent of covers if the Document is in electronic form.
Otherwise they must appear on printed covers that bracket the whole
aggregate.
<li>TRANSLATION
<p>Translation is considered a kind of modification, so you may
distribute translations of the Document under the terms of section 4.
Replacing Invariant Sections with translations requires special
permission from their copyright holders, but you may include
translations of some or all Invariant Sections in addition to the
original versions of these Invariant Sections. You may include a
translation of this License, and all the license notices in the
Document, and any Warranty Disclaimers, provided that you also include
the original English version of this License and the original versions
of those notices and disclaimers. In case of a disagreement between
the translation and the original version of this License or a notice
or disclaimer, the original version will prevail.
<p>If a section in the Document is Entitled “Acknowledgements”,
“Dedications”, or “History”, the requirement (section 4) to Preserve
its Title (section 1) will typically require changing the actual
title.
<li>TERMINATION
<p>You may not copy, modify, sublicense, or distribute the Document
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense, or distribute it is void, and
will automatically terminate your rights under this License.
<p>However, if you cease all violation of this License, then your license
from a particular copyright holder is reinstated (a) provisionally,
unless and until the copyright holder explicitly and finally
terminates your license, and (b) permanently, if the copyright holder
fails to notify you of the violation by some reasonable means prior to
60 days after the cessation.
<p>Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
<p>Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, receipt of a copy of some or all of the same material does
not give you any rights to use it.
<li>FUTURE REVISIONS OF THIS LICENSE
<p>The Free Software Foundation may publish new, revised versions
of the GNU Free Documentation License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns. See
<a href="http://www.gnu.org/copyleft/">http://www.gnu.org/copyleft/</a>.
<p>Each version of the License is given a distinguishing version number.
If the Document specifies that a particular numbered version of this
License “or any later version” applies to it, you have the option of
following the terms and conditions either of that specified version or
of any later version that has been published (not as a draft) by the
Free Software Foundation. If the Document does not specify a version
number of this License, you may choose any version ever published (not
as a draft) by the Free Software Foundation. If the Document
specifies that a proxy can decide which future versions of this
License can be used, that proxy's public statement of acceptance of a
version permanently authorizes you to choose that version for the
Document.
<li>RELICENSING
<p>“Massive Multiauthor Collaboration Site” (or “MMC Site”) means any
World Wide Web server that publishes copyrightable works and also
provides prominent facilities for anybody to edit those works. A
public wiki that anybody can edit is an example of such a server. A
“Massive Multiauthor Collaboration” (or “MMC”) contained in the
site means any set of copyrightable works thus published on the MMC
site.
<p>“CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0
license published by Creative Commons Corporation, a not-for-profit
corporation with a principal place of business in San Francisco,
California, as well as future copyleft versions of that license
published by that same organization.
<p>“Incorporate” means to publish or republish a Document, in whole or
in part, as part of another Document.
<p>An MMC is “eligible for relicensing” if it is licensed under this
License, and if all works that were first published under this License
somewhere other than this MMC, and subsequently incorporated in whole
or in part into the MMC, (1) had no cover texts or invariant sections,
and (2) were thus incorporated prior to November 1, 2008.
<p>The operator of an MMC Site may republish an MMC contained in the site
under CC-BY-SA on the same site at any time before August 1, 2009,
provided the MMC is eligible for relicensing.
</ol>
<h3 class="heading">ADDENDUM: How to use this License for your documents</h3>
<p>To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and
license notices just after the title page:
<pre class="smallexample"> Copyright (C) <var>year</var> <var>your name</var>.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
Texts. A copy of the license is included in the section entitled ``GNU
Free Documentation License''.
</pre>
<p>If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
replace the “with<small class="dots">...</small>Texts.” line with this:
<pre class="smallexample"> with the Invariant Sections being <var>list their titles</var>, with
the Front-Cover Texts being <var>list</var>, and with the Back-Cover Texts
being <var>list</var>.
</pre>
<p>If you have Invariant Sections without Cover Texts, or some other
combination of the three, merge those two alternatives to suit the
situation.
<p>If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of
free software license, such as the GNU General Public License,
to permit their use in free software.
<!-- Local Variables: -->
<!-- ispell-local-pdict: "ispell-dict" -->
<!-- End: -->
<div class="node">
<a name="GNU-LGPL"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#GNU-GPL">GNU GPL</a>,
Previous: <a rel="previous" accesskey="p" href="#GNU-Free-Documentation-License">GNU Free Documentation License</a>,
Up: <a rel="up" accesskey="u" href="#Copying-Information">Copying Information</a>
</div>
<h3 class="appendixsec">C.2 GNU Lesser General Public License</h3>
<p><a name="index-LGPL_002c-GNU-Lesser-General-Public-License-129"></a><a name="index-License_002c-GNU-LGPL-130"></a>
<!-- The GNU Lesser General Public License. -->
<div align="center">Version 2.1, February 1999</div>
<!-- This file is intended to be included within another document, -->
<!-- hence no sectioning command or @node. -->
<pre class="display"> Copyright © 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence the
version number 2.1.]
</pre>
<h4 class="subheading">Preamble</h4>
<p>The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software—to make sure the software is free for all its users.
<p>This license, the Lesser General Public License, applies to some
specially designated software—typically libraries—of the Free
Software Foundation and other authors who decide to use it. You can use
it too, but we suggest you first think carefully about whether this
license or the ordinary General Public License is the better strategy to
use in any particular case, based on the explanations below.
<p>When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of it
in new free programs; and that you are informed that you can do these
things.
<p>To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
<p>For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
<p>We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
<p>To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
<p>Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
<p>Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
<p>When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
<p>We call this license the <dfn>Lesser</dfn> General Public License because it
does <em>Less</em> to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
<p>For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
<p>In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
<p>Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
<p>The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
“work based on the library” and a “work that uses the library”. The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
<h4 class="subheading">TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</h4>
<ol type=1 start=0>
<li>This License Agreement applies to any software library or other program
which contains a notice placed by the copyright holder or other
authorized party saying it may be distributed under the terms of this
Lesser General Public License (also called “this License”). Each
licensee is addressed as “you”.
<p>A “library” means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
<p>The “Library”, below, refers to any such software library or work
which has been distributed under these terms. A “work based on the
Library” means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term “modification”.)
<p>“Source code” for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
<p>Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
<li>You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
<p>You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
<li>You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
<ol type=a start=1>
<li>The modified work must itself be a software library.
<li>You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
<li>You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
<li>If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
<p>(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
</ol>
<p>These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
<p>Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
<p>In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
<li>You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
<p>Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
<p>This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
<li>You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
<p>If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
<li>A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a “work that uses the Library”. Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
<p>However, linking a “work that uses the Library” with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a “work that uses the
library”. The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
<p>When a “work that uses the Library” uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
<p>If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
<p>Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
<li>As an exception to the Sections above, you may also combine or
link a “work that uses the Library” with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
<p>You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
<ol type=a start=1>
<li>Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable “work that
uses the Library”, as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
<li>Use a suitable shared library mechanism for linking with the Library. A
suitable mechanism is one that (1) uses at run time a copy of the
library already present on the user's computer system, rather than
copying library functions into the executable, and (2) will operate
properly with a modified version of the library, if the user installs
one, as long as the modified version is interface-compatible with the
version that the work was made with.
<li>Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
<li>If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
<li>Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
</ol>
<p>For an executable, the required form of the “work that uses the
Library” must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies the
executable.
<p>It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
<li>You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
<ol type=a start=1>
<li>Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
<li>Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
</ol>
<li>You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
<li>You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
<li>Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
<li>If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
<p>If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
<p>It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
<p>This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
<li>If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
<li>The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
<p>Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
“any later version”, you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
<li>If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
<li>BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY “AS IS” WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
<li>IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
</ol>
<h4 class="subheading">How to Apply These Terms to Your New Libraries</h4>
<p>If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
<p>To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
“copyright” line and a pointer to where the full notice is found.
<pre class="smallexample"> <var>one line to give the library's name and an idea of what it does.</var>
Copyright (C) <var>year</var> <var>name of author</var>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA.
</pre>
<p>Also add information on how to contact you by electronic and paper mail.
<p>You should also get your employer (if you work as a programmer) or your
school, if any, to sign a “copyright disclaimer” for the library, if
necessary. Here is a sample; alter the names:
<pre class="smallexample"> Yoyodyne, Inc., hereby disclaims all copyright interest in the library
`Frob' (a library for tweaking knobs) written by James Random Hacker.
<var>signature of Ty Coon</var>, 1 April 1990
Ty Coon, President of Vice
</pre>
<p>That's all there is to it!
<div class="node">
<a name="GNU-GPL"></a>
<p><hr>
Previous: <a rel="previous" accesskey="p" href="#GNU-LGPL">GNU LGPL</a>,
Up: <a rel="up" accesskey="u" href="#Copying-Information">Copying Information</a>
</div>
<h3 class="appendixsec">C.3 GNU General Public License</h3>
<p><a name="index-GPL_002c-GNU-General-Public-License-131"></a><a name="index-License_002c-GNU-GPL-132"></a>
<!-- The GNU General Public License. -->
<div align="center">Version 3, 29 June 2007</div>
<!-- This file is intended to be included within another document, -->
<!-- hence no sectioning command or @node. -->
<pre class="display"> Copyright © 2007 Free Software Foundation, Inc. <a href="http://fsf.org/">http://fsf.org/</a>
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
</pre>
<h3 class="heading">Preamble</h3>
<p>The GNU General Public License is a free, copyleft license for
software and other kinds of works.
<p>The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom
to share and change all versions of a program—to make sure it remains
free software for all its users. We, the Free Software Foundation,
use the GNU General Public License for most of our software; it
applies also to any other work released this way by its authors. You
can apply it to your programs, too.
<p>When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
<p>To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you
have certain responsibilities if you distribute copies of the
software, or if you modify it: responsibilities to respect the freedom
of others.
<p>For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too,
receive or can get the source code. And you must show them these
terms so they know their rights.
<p>Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
<p>For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
<p>Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the
manufacturer can do so. This is fundamentally incompatible with the
aim of protecting users' freedom to change the software. The
systematic pattern of such abuse occurs in the area of products for
individuals to use, which is precisely where it is most unacceptable.
Therefore, we have designed this version of the GPL to prohibit the
practice for those products. If such problems arise substantially in
other domains, we stand ready to extend this provision to those
domains in future versions of the GPL, as needed to protect the
freedom of users.
<p>Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish
to avoid the special danger that patents applied to a free program
could make it effectively proprietary. To prevent this, the GPL
assures that patents cannot be used to render the program non-free.
<p>The precise terms and conditions for copying, distribution and
modification follow.
<h3 class="heading">TERMS AND CONDITIONS</h3>
<ol type=1 start=0>
<li>Definitions.
<p>“This License” refers to version 3 of the GNU General Public License.
<p>“Copyright” also means copyright-like laws that apply to other kinds
of works, such as semiconductor masks.
<p>“The Program” refers to any copyrightable work licensed under this
License. Each licensee is addressed as “you”. “Licensees” and
“recipients” may be individuals or organizations.
<p>To “modify” a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of
an exact copy. The resulting work is called a “modified version” of
the earlier work or a work “based on” the earlier work.
<p>A “covered work” means either the unmodified Program or a work based
on the Program.
<p>To “propagate” a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
<p>To “convey” a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user
through a computer network, with no transfer of a copy, is not
conveying.
<p>An interactive user interface displays “Appropriate Legal Notices” to
the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
<li>Source Code.
<p>The “source code” for a work means the preferred form of the work for
making modifications to it. “Object code” means any non-source form
of a work.
<p>A “Standard Interface” means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
<p>The “System Libraries” of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
“Major Component”, in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
<p>The “Corresponding Source” for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
<p>The Corresponding Source need not include anything that users can
regenerate automatically from other parts of the Corresponding Source.
<p>The Corresponding Source for a work in source code form is that same
work.
<li>Basic Permissions.
<p>All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
<p>You may make, run and propagate covered works that you do not convey,
without conditions so long as your license otherwise remains in force.
You may convey covered works to others for the sole purpose of having
them make modifications exclusively for you, or provide you with
facilities for running those works, provided that you comply with the
terms of this License in conveying all material for which you do not
control copyright. Those thus making or running the covered works for
you must do so exclusively on your behalf, under your direction and
control, on terms that prohibit them from making any copies of your
copyrighted material outside their relationship with you.
<p>Conveying under any other circumstances is permitted solely under the
conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
<li>Protecting Users' Legal Rights From Anti-Circumvention Law.
<p>No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
<p>When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such
circumvention is effected by exercising rights under this License with
respect to the covered work, and you disclaim any intention to limit
operation or modification of the work as a means of enforcing, against
the work's users, your or third parties' legal rights to forbid
circumvention of technological measures.
<li>Conveying Verbatim Copies.
<p>You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
<p>You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
<li>Conveying Modified Source Versions.
<p>You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these
conditions:
<ol type=a start=1>
<li>The work must carry prominent notices stating that you modified it,
and giving a relevant date.
<li>The work must carry prominent notices stating that it is released
under this License and any conditions added under section 7. This
requirement modifies the requirement in section 4 to “keep intact all
notices”.
<li>You must license the entire work, as a whole, under this License to
anyone who comes into possession of a copy. This License will
therefore apply, along with any applicable section 7 additional terms,
to the whole of the work, and all its parts, regardless of how they
are packaged. This License gives no permission to license the work in
any other way, but it does not invalidate such permission if you have
separately received it.
<li>If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your work
need not make them do so.
</ol>
<p>A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
“aggregate” if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
<li>Conveying Non-Source Forms.
<p>You may convey a covered work in object code form under the terms of
sections 4 and 5, provided that you also convey the machine-readable
Corresponding Source under the terms of this License, in one of these
ways:
<ol type=a start=1>
<li>Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium customarily
used for software interchange.
<li>Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a written
offer, valid for at least three years and valid for as long as you
offer spare parts or customer support for that product model, to give
anyone who possesses the object code either (1) a copy of the
Corresponding Source for all the software in the product that is
covered by this License, on a durable physical medium customarily used
for software interchange, for a price no more than your reasonable
cost of physically performing this conveying of source, or (2) access
to copy the Corresponding Source from a network server at no charge.
<li>Convey individual copies of the object code with a copy of the written
offer to provide the Corresponding Source. This alternative is
allowed only occasionally and noncommercially, and only if you
received the object code with such an offer, in accord with subsection
6b.
<li>Convey the object code by offering access from a designated place
(gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to copy
the object code is a network server, the Corresponding Source may be
on a different server (operated by you or a third party) that supports
equivalent copying facilities, provided you maintain clear directions
next to the object code saying where to find the Corresponding Source.
Regardless of what server hosts the Corresponding Source, you remain
obligated to ensure that it is available for as long as needed to
satisfy these requirements.
<li>Convey the object code using peer-to-peer transmission, provided you
inform other peers where the object code and Corresponding Source of
the work are being offered to the general public at no charge under
subsection 6d.
</ol>
<p>A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
<p>A “User Product” is either (1) a “consumer product”, which means any
tangible personal property which is normally used for personal,
family, or household purposes, or (2) anything designed or sold for
incorporation into a dwelling. In determining whether a product is a
consumer product, doubtful cases shall be resolved in favor of
coverage. For a particular product received by a particular user,
“normally used” refers to a typical or common use of that class of
product, regardless of the status of the particular user or of the way
in which the particular user actually uses, or expects or is expected
to use, the product. A product is a consumer product regardless of
whether the product has substantial commercial, industrial or
non-consumer uses, unless such uses represent the only significant
mode of use of the product.
<p>“Installation Information” for a User Product means any methods,
procedures, authorization keys, or other information required to
install and execute modified versions of a covered work in that User
Product from a modified version of its Corresponding Source. The
information must suffice to ensure that the continued functioning of
the modified object code is in no case prevented or interfered with
solely because modification has been made.
<p>If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
<p>The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or
updates for a work that has been modified or installed by the
recipient, or for the User Product in which it has been modified or
installed. Access to a network may be denied when the modification
itself materially and adversely affects the operation of the network
or violates the rules and protocols for communication across the
network.
<p>Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
<li>Additional Terms.
<p>“Additional permissions” are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
<p>When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
<p>Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders
of that material) supplement the terms of this License with terms:
<ol type=a start=1>
<li>Disclaiming warranty or limiting liability differently from the terms
of sections 15 and 16 of this License; or
<li>Requiring preservation of specified reasonable legal notices or author
attributions in that material or in the Appropriate Legal Notices
displayed by works containing it; or
<li>Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
<li>Limiting the use for publicity purposes of names of licensors or
authors of the material; or
<li>Declining to grant rights under trademark law for use of some trade
names, trademarks, or service marks; or
<li>Requiring indemnification of licensors and authors of that material by
anyone who conveys the material (or modified versions of it) with
contractual assumptions of liability to the recipient, for any
liability that these contractual assumptions directly impose on those
licensors and authors.
</ol>
<p>All other non-permissive additional terms are considered “further
restrictions” within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
<p>If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
<p>Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions; the
above requirements apply either way.
<li>Termination.
<p>You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
<p>However, if you cease all violation of this License, then your license
from a particular copyright holder is reinstated (a) provisionally,
unless and until the copyright holder explicitly and finally
terminates your license, and (b) permanently, if the copyright holder
fails to notify you of the violation by some reasonable means prior to
60 days after the cessation.
<p>Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
<p>Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
<li>Acceptance Not Required for Having Copies.
<p>You are not required to accept this License in order to receive or run
a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
<li>Automatic Licensing of Downstream Recipients.
<p>Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
<p>An “entity transaction” is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
<p>You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
<li>Patents.
<p>A “contributor” is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's “contributor version”.
<p>A contributor's “essential patent claims” are all patent claims owned
or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, “control” includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
<p>Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
<p>In the following three paragraphs, a “patent license” is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To “grant” such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
<p>If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. “Knowingly relying” means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
<p>If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
<p>A patent license is “discriminatory” if it does not include within the
scope of its coverage, prohibits the exercise of, or is conditioned on
the non-exercise of one or more of the rights that are specifically
granted under this License. You may not convey a covered work if you
are a party to an arrangement with a third party that is in the
business of distributing software, under which you make payment to the
third party based on the extent of your activity of conveying the
work, and under which the third party grants, to any of the parties
who would receive the covered work from you, a discriminatory patent
license (a) in connection with copies of the covered work conveyed by
you (or copies made from those copies), or (b) primarily for and in
connection with specific products or compilations that contain the
covered work, unless you entered into that arrangement, or that patent
license was granted, prior to 28 March 2007.
<p>Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
<li>No Surrender of Others' Freedom.
<p>If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey
a covered work so as to satisfy simultaneously your obligations under
this License and any other pertinent obligations, then as a
consequence you may not convey it at all. For example, if you agree
to terms that obligate you to collect a royalty for further conveying
from those to whom you convey the Program, the only way you could
satisfy both those terms and this License would be to refrain entirely
from conveying the Program.
<li>Use with the GNU Affero General Public License.
<p>Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
<li>Revised Versions of this License.
<p>The Free Software Foundation may publish revised and/or new versions
of the GNU General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
<p>Each version is given a distinguishing version number. If the Program
specifies that a certain numbered version of the GNU General Public
License “or any later version” applies to it, you have the option of
following the terms and conditions either of that numbered version or
of any later version published by the Free Software Foundation. If
the Program does not specify a version number of the GNU General
Public License, you may choose any version ever published by the Free
Software Foundation.
<p>If the Program specifies that a proxy can decide which future versions
of the GNU General Public License can be used, that proxy's public
statement of acceptance of a version permanently authorizes you to
choose that version for the Program.
<p>Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
<li>Disclaimer of Warranty.
<p>THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
CORRECTION.
<li>Limitation of Liability.
<p>IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR
CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT
NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR
LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM
TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
<li>Interpretation of Sections 15 and 16.
<p>If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
</ol>
<h3 class="heading">END OF TERMS AND CONDITIONS</h3>
<h3 class="heading">How to Apply These Terms to Your New Programs</h3>
<p>If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.
<p>To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the “copyright” line and a pointer to where the full notice is found.
<pre class="smallexample"> <var>one line to give the program's name and a brief idea of what it does.</var>
Copyright (C) <var>year</var> <var>name of author</var>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>.
</pre>
<p>Also add information on how to contact you by electronic and paper mail.
<p>If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<pre class="smallexample"> <var>program</var> Copyright (C) <var>year</var> <var>name of author</var>
This program comes with ABSOLUTELY NO WARRANTY; for details type ‘<samp><span class="samp">show w</span></samp>’.
This is free software, and you are welcome to redistribute it
under certain conditions; type ‘<samp><span class="samp">show c</span></samp>’ for details.
</pre>
<p>The hypothetical commands ‘<samp><span class="samp">show w</span></samp>’ and ‘<samp><span class="samp">show c</span></samp>’ should show
the appropriate parts of the General Public License. Of course, your
program's commands might be different; for a GUI interface, you would
use an “about box”.
<p>You should also get your employer (if you work as a programmer) or school,
if any, to sign a “copyright disclaimer” for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>.
<p>The GNU General Public License does not permit incorporating your
program into proprietary programs. If your program is a subroutine
library, you may consider it more useful to permit linking proprietary
applications with the library. If this is what you want to do, use
the GNU Lesser General Public License instead of this License. But
first, please read <a href="http://www.gnu.org/philosophy/why-not-lgpl.html">http://www.gnu.org/philosophy/why-not-lgpl.html</a>.
<div class="node">
<a name="Function-and-Variable-Index"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Concept-Index">Concept Index</a>,
Previous: <a rel="previous" accesskey="p" href="#Copying-Information">Copying Information</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="unnumbered">Function and Variable Index</h2>
<ul class="index-fn" compact>
<li><a href="#index-idn_005ffree-48"><code>idn_free</code></a>: <a href="#Memory-handling-under-Windows">Memory handling under Windows</a></li>
<li><a href="#index-idna_002dto_002dascii-126"><code>idna-to-ascii</code></a>: <a href="#Emacs-API">Emacs API</a></li>
<li><a href="#index-idna_002dto_002dunicode-127"><code>idna-to-unicode</code></a>: <a href="#Emacs-API">Emacs API</a></li>
<li><a href="#index-idna_005fstrerror-93"><code>idna_strerror</code></a>: <a href="#IDNA-Functions">IDNA Functions</a></li>
<li><a href="#index-idna_005fto_005fascii_005f4i-83"><code>idna_to_ascii_4i</code></a>: <a href="#IDNA-Functions">IDNA Functions</a></li>
<li><a href="#index-idna_005fto_005fascii_005f4z-85"><code>idna_to_ascii_4z</code></a>: <a href="#IDNA-Functions">IDNA Functions</a></li>
<li><a href="#index-idna_005fto_005fascii_005f8z-86"><code>idna_to_ascii_8z</code></a>: <a href="#IDNA-Functions">IDNA Functions</a></li>
<li><a href="#index-idna_005fto_005fascii_005flz-87"><code>idna_to_ascii_lz</code></a>: <a href="#IDNA-Functions">IDNA Functions</a></li>
<li><a href="#index-idna_005fto_005funicode_005f44i-84"><code>idna_to_unicode_44i</code></a>: <a href="#IDNA-Functions">IDNA Functions</a></li>
<li><a href="#index-idna_005fto_005funicode_005f4z4z-88"><code>idna_to_unicode_4z4z</code></a>: <a href="#IDNA-Functions">IDNA Functions</a></li>
<li><a href="#index-idna_005fto_005funicode_005f8z4z-89"><code>idna_to_unicode_8z4z</code></a>: <a href="#IDNA-Functions">IDNA Functions</a></li>
<li><a href="#index-idna_005fto_005funicode_005f8z8z-90"><code>idna_to_unicode_8z8z</code></a>: <a href="#IDNA-Functions">IDNA Functions</a></li>
<li><a href="#index-idna_005fto_005funicode_005f8zlz-91"><code>idna_to_unicode_8zlz</code></a>: <a href="#IDNA-Functions">IDNA Functions</a></li>
<li><a href="#index-idna_005fto_005funicode_005flzlz-92"><code>idna_to_unicode_lzlz</code></a>: <a href="#IDNA-Functions">IDNA Functions</a></li>
<li><a href="#index-pr29_005f4-108"><code>pr29_4</code></a>: <a href="#PR29-Functions">PR29 Functions</a></li>
<li><a href="#index-pr29_005f4z-109"><code>pr29_4z</code></a>: <a href="#PR29-Functions">PR29 Functions</a></li>
<li><a href="#index-pr29_005f8z-110"><code>pr29_8z</code></a>: <a href="#PR29-Functions">PR29 Functions</a></li>
<li><a href="#index-pr29_005fstrerror-111"><code>pr29_strerror</code></a>: <a href="#PR29-Functions">PR29 Functions</a></li>
<li><a href="#index-punycode_002ddecode-121"><code>punycode-decode</code></a>: <a href="#Emacs-API">Emacs API</a></li>
<li><a href="#index-punycode_002dencode-120"><code>punycode-encode</code></a>: <a href="#Emacs-API">Emacs API</a></li>
<li><a href="#index-punycode_005fdecode-77"><code>punycode_decode</code></a>: <a href="#Punycode-Functions">Punycode Functions</a></li>
<li><a href="#index-punycode_005fencode-76"><code>punycode_encode</code></a>: <a href="#Punycode-Functions">Punycode Functions</a></li>
<li><a href="#index-punycode_005fstrerror-78"><code>punycode_strerror</code></a>: <a href="#Punycode-Functions">Punycode Functions</a></li>
<li><a href="#index-stringprep-66"><code>stringprep</code></a>: <a href="#Stringprep-Functions">Stringprep Functions</a></li>
<li><a href="#index-stringprep_005f4i-64"><code>stringprep_4i</code></a>: <a href="#Stringprep-Functions">Stringprep Functions</a></li>
<li><a href="#index-stringprep_005f4zi-65"><code>stringprep_4zi</code></a>: <a href="#Stringprep-Functions">Stringprep Functions</a></li>
<li><a href="#index-stringprep_005fcheck_005fversion-40"><code>stringprep_check_version</code></a>: <a href="#Version-Check">Version Check</a></li>
<li><a href="#index-stringprep_005fconvert-57"><code>stringprep_convert</code></a>: <a href="#Utility-Functions">Utility Functions</a></li>
<li><a href="#index-stringprep_005fiscsi-70"><code>stringprep_iscsi</code></a>: <a href="#Stringprep-Functions">Stringprep Functions</a></li>
<li><a href="#index-stringprep_005flocale_005fcharset-56"><code>stringprep_locale_charset</code></a>: <a href="#Utility-Functions">Utility Functions</a></li>
<li><a href="#index-stringprep_005flocale_005fto_005futf8-58"><code>stringprep_locale_to_utf8</code></a>: <a href="#Utility-Functions">Utility Functions</a></li>
<li><a href="#index-stringprep_005fnameprep_005fno_005funassigned-69"><code>stringprep_nameprep_no_unassigned</code></a>: <a href="#Stringprep-Functions">Stringprep Functions</a></li>
<li><a href="#index-stringprep_005fplain-71"><code>stringprep_plain</code></a>: <a href="#Stringprep-Functions">Stringprep Functions</a></li>
<li><a href="#index-stringprep_005fprofile-67"><code>stringprep_profile</code></a>: <a href="#Stringprep-Functions">Stringprep Functions</a></li>
<li><a href="#index-stringprep_005fstrerror-68"><code>stringprep_strerror</code></a>: <a href="#Stringprep-Functions">Stringprep Functions</a></li>
<li><a href="#index-stringprep_005fucs4_005fnfkc_005fnormalize-54"><code>stringprep_ucs4_nfkc_normalize</code></a>: <a href="#Utility-Functions">Utility Functions</a></li>
<li><a href="#index-stringprep_005fucs4_005fto_005futf8-52"><code>stringprep_ucs4_to_utf8</code></a>: <a href="#Utility-Functions">Utility Functions</a></li>
<li><a href="#index-stringprep_005funichar_005fto_005futf8-50"><code>stringprep_unichar_to_utf8</code></a>: <a href="#Utility-Functions">Utility Functions</a></li>
<li><a href="#index-stringprep_005futf8_005fnfkc_005fnormalize-55"><code>stringprep_utf8_nfkc_normalize</code></a>: <a href="#Utility-Functions">Utility Functions</a></li>
<li><a href="#index-stringprep_005futf8_005fto_005flocale-59"><code>stringprep_utf8_to_locale</code></a>: <a href="#Utility-Functions">Utility Functions</a></li>
<li><a href="#index-stringprep_005futf8_005fto_005fucs4-53"><code>stringprep_utf8_to_ucs4</code></a>: <a href="#Utility-Functions">Utility Functions</a></li>
<li><a href="#index-stringprep_005futf8_005fto_005funichar-51"><code>stringprep_utf8_to_unichar</code></a>: <a href="#Utility-Functions">Utility Functions</a></li>
<li><a href="#index-stringprep_005fxmpp_005fnodeprep-72"><code>stringprep_xmpp_nodeprep</code></a>: <a href="#Stringprep-Functions">Stringprep Functions</a></li>
<li><a href="#index-stringprep_005fxmpp_005fresourceprep-73"><code>stringprep_xmpp_resourceprep</code></a>: <a href="#Stringprep-Functions">Stringprep Functions</a></li>
<li><a href="#index-tld_005fcheck_005f4-102"><code>tld_check_4</code></a>: <a href="#TLD-Functions">TLD Functions</a></li>
<li><a href="#index-tld_005fcheck_005f4t-95"><code>tld_check_4t</code></a>: <a href="#TLD-Functions">TLD Functions</a></li>
<li><a href="#index-tld_005fcheck_005f4tz-96"><code>tld_check_4tz</code></a>: <a href="#TLD-Functions">TLD Functions</a></li>
<li><a href="#index-tld_005fcheck_005f4z-103"><code>tld_check_4z</code></a>: <a href="#TLD-Functions">TLD Functions</a></li>
<li><a href="#index-tld_005fcheck_005f8z-104"><code>tld_check_8z</code></a>: <a href="#TLD-Functions">TLD Functions</a></li>
<li><a href="#index-tld_005fcheck_005flz-105"><code>tld_check_lz</code></a>: <a href="#TLD-Functions">TLD Functions</a></li>
<li><a href="#index-tld_005fdefault_005ftable-101"><code>tld_default_table</code></a>: <a href="#TLD-Functions">TLD Functions</a></li>
<li><a href="#index-tld_005fget_005f4-97"><code>tld_get_4</code></a>: <a href="#TLD-Functions">TLD Functions</a></li>
<li><a href="#index-tld_005fget_005f4z-98"><code>tld_get_4z</code></a>: <a href="#TLD-Functions">TLD Functions</a></li>
<li><a href="#index-tld_005fget_005ftable-100"><code>tld_get_table</code></a>: <a href="#TLD-Functions">TLD Functions</a></li>
<li><a href="#index-tld_005fget_005fz-99"><code>tld_get_z</code></a>: <a href="#TLD-Functions">TLD Functions</a></li>
<li><a href="#index-tld_005fstrerror-106"><code>tld_strerror</code></a>: <a href="#TLD-Functions">TLD Functions</a></li>
</ul><div class="node">
<a name="Concept-Index"></a>
<p><hr>
Previous: <a rel="previous" accesskey="p" href="#Function-and-Variable-Index">Function and Variable Index</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="unnumbered">Concept Index</h2>
<ul class="index-cp" compact>
<li><a href="#index-AIX-15">AIX</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-ARM-29">ARM</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-Autoconf-tests-42">Autoconf tests</a>: <a href="#Autoconf-tests">Autoconf tests</a></li>
<li><a href="#index-command-line-115">command line</a>: <a href="#Invoking-idn">Invoking idn</a></li>
<li><a href="#index-Compiling-your-application-41">Compiling your application</a>: <a href="#Building-the-source">Building the source</a></li>
<li><a href="#index-Configure-tests-43">Configure tests</a>: <a href="#Autoconf-tests">Autoconf tests</a></li>
<li><a href="#index-Contributing-38">Contributing</a>: <a href="#Contributing">Contributing</a></li>
<li><a href="#index-de_002dallocation-46">de-allocation</a>: <a href="#Memory-handling-under-Windows">Memory handling under Windows</a></li>
<li><a href="#index-Debian-1">Debian</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-Download-36">Download</a>: <a href="#Downloading-and-Installing">Downloading and Installing</a></li>
<li><a href="#index-Examples-112">Examples</a>: <a href="#Examples">Examples</a></li>
<li><a href="#index-FDL_002c-GNU-Free-Documentation-License-128">FDL, GNU Free Documentation License</a>: <a href="#GNU-Free-Documentation-License">GNU Free Documentation License</a></li>
<li><a href="#index-free-44">free</a>: <a href="#Memory-handling-under-Windows">Memory handling under Windows</a></li>
<li><a href="#index-FreeBSD-23">FreeBSD</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-GPL_002c-GNU-General-Public-License-131">GPL, GNU General Public License</a>: <a href="#GNU-GPL">GNU GPL</a></li>
<li><a href="#index-Hacking-39">Hacking</a>: <a href="#Contributing">Contributing</a></li>
<li><a href="#index-heap-memory-47">heap memory</a>: <a href="#Memory-handling-under-Windows">Memory handling under Windows</a></li>
<li><a href="#index-HP_002dUX-17">HP-UX</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-IBM-34">IBM</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-idn-113"><code>idn</code></a>: <a href="#Invoking-idn">Invoking idn</a></li>
<li><a href="#index-IDNA-Functions-79">IDNA Functions</a>: <a href="#IDNA-Functions">IDNA Functions</a></li>
<li><a href="#index-Installation-35">Installation</a>: <a href="#Downloading-and-Installing">Downloading and Installing</a></li>
<li><a href="#index-invoking-_0040command_007bidn_007d-114">invoking <samp><span class="command">idn</span></samp></a>: <a href="#Invoking-idn">Invoking idn</a></li>
<li><a href="#index-IRIX-14">IRIX</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-LGPL_002c-GNU-Lesser-General-Public-License-129">LGPL, GNU Lesser General Public License</a>: <a href="#GNU-LGPL">GNU LGPL</a></li>
<li><a href="#index-License_002c-GNU-GPL-132">License, GNU GPL</a>: <a href="#GNU-GPL">GNU GPL</a></li>
<li><a href="#index-License_002c-GNU-LGPL-130">License, GNU LGPL</a>: <a href="#GNU-LGPL">GNU LGPL</a></li>
<li><a href="#index-MacOS-X-24">MacOS X</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-Mandrake-13">Mandrake</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-Memory-handling-45">Memory handling</a>: <a href="#Memory-handling-under-Windows">Memory handling under Windows</a></li>
<li><a href="#index-Microsoft-31">Microsoft</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-mingw32-32">mingw32</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-Motorola-Coldfire-26">Motorola Coldfire</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-NetBSD-21">NetBSD</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-OpenBSD-22">OpenBSD</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-OpenPower-720-8">OpenPower 720</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-OS_002f2-33">OS/2</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-PR29-Functions-107">PR29 Functions</a>: <a href="#PR29-Functions">PR29 Functions</a></li>
<li><a href="#index-Punycode-Functions-74">Punycode Functions</a>: <a href="#Punycode-Functions">Punycode Functions</a></li>
<li><a href="#index-RedHat-9">RedHat</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-RedHat-Advanced-Server-11">RedHat Advanced Server</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-Reporting-Bugs-37">Reporting Bugs</a>: <a href="#Bug-Reports">Bug Reports</a></li>
<li><a href="#index-Solaris-18">Solaris</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-Stringprep-Functions-60">Stringprep Functions</a>: <a href="#Stringprep-Functions">Stringprep Functions</a></li>
<li><a href="#index-SuSE-4">SuSE</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-SuSE-Linux-5">SuSE Linux</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-TLD-Functions-94">TLD Functions</a>: <a href="#TLD-Functions">TLD Functions</a></li>
<li><a href="#index-Tru64-3">Tru64</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-uClibc-28">uClibc</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-uClinux-27">uClinux</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-Utility-Functions-49">Utility Functions</a>: <a href="#Utility-Functions">Utility Functions</a></li>
<li><a href="#index-Windows-16">Windows</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
</ul><div class="footnote">
<hr>
<a name="texinfo-footnotes-in-document"></a><h4>Footnotes</h4><p class="footnote"><small>[<a name="fn-1" href="#fnd-1">1</a>]</small> Notably Microsoft's Internet Explorer
and Mozilla's Firefox, but not Apple's Safari.</p>
<hr></div>
</body></html>
<!--
Local Variables:
coding: utf-8
End:
-->
Copyright 2K16 - 2K18 Indonesian Hacker Rulez