1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>punycode</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.0">
<link rel="home" href="index.html" title="GNU Libidn API Reference Manual">
<link rel="up" href="ch01.html" title="GNU Libidn API Reference Manual">
<link rel="prev" href="libidn-pr29.html" title="pr29">
<link rel="next" href="libidn-tld.html" title="tld">
<meta name="generator" content="GTK-Doc V1.11 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="ch01.html" title="GNU Libidn API Reference Manual">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="libidn-pr29.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="ch01.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GNU Libidn API Reference Manual</th>
<td><a accesskey="n" href="libidn-tld.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#libidn-punycode.synopsis" class="shortcut">Top</a>
|
<a href="#libidn-punycode.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry" title="punycode">
<a name="libidn-punycode"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="libidn-punycode.top_of_page"></a>punycode</span></h2>
<p>punycode</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv" title="Synopsis">
<a name="libidn-punycode.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#define <a class="link" href="libidn-idna.html#IDNAPI--CAPS" title="IDNAPI">IDNAPI</a>
enum <a class="link" href="libidn-punycode.html#Punycode-status" title="enum Punycode_status">Punycode_status</a>;
const char * <a class="link" href="libidn-punycode.html#punycode-strerror" title="punycode_strerror ()">punycode_strerror</a> (<a class="link" href="libidn-punycode.html#Punycode-status" title="enum Punycode_status">Punycode_status</a> rc);
typedef <a class="link" href="libidn-punycode.html#punycode-uint" title="punycode_uint">punycode_uint</a>;
int <a class="link" href="libidn-punycode.html#punycode-encode" title="punycode_encode ()">punycode_encode</a> (size_t input_length,
const <a class="link" href="libidn-punycode.html#punycode-uint" title="punycode_uint">punycode_uint</a> input[],
unsigned char case_flags[],
size_t *output_length,
char output[]);
int <a class="link" href="libidn-punycode.html#punycode-decode" title="punycode_decode ()">punycode_decode</a> (size_t input_length,
const char input[],
size_t *output_length,
<a class="link" href="libidn-punycode.html#punycode-uint" title="punycode_uint">punycode_uint</a> output[],
unsigned char case_flags[]);
</pre>
</div>
<div class="refsect1" title="Description">
<a name="libidn-punycode.description"></a><h2>Description</h2>
<p>
</p>
</div>
<div class="refsect1" title="Details">
<a name="libidn-punycode.details"></a><h2>Details</h2>
<div class="refsect2" title="IDNAPI">
<a name="IDNAPI--CAPS"></a><h3>IDNAPI</h3>
<pre class="programlisting">#define IDNAPI</pre>
<p>
</p>
</div>
<hr>
<div class="refsect2" title="enum Punycode_status">
<a name="Punycode-status"></a><h3>enum Punycode_status</h3>
<pre class="programlisting"> typedef enum
{
PUNYCODE_SUCCESS = punycode_success,
PUNYCODE_BAD_INPUT = punycode_bad_input,
PUNYCODE_BIG_OUTPUT = punycode_big_output,
PUNYCODE_OVERFLOW = punycode_overflow
} Punycode_status;
</pre>
<p>
Enumerated return codes of <a class="link" href="libidn-punycode.html#punycode-encode" title="punycode_encode ()"><code class="function">punycode_encode()</code></a> and <a class="link" href="libidn-punycode.html#punycode-decode" title="punycode_decode ()"><code class="function">punycode_decode()</code></a>.
The value 0 is guaranteed to always correspond to success.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><a name="PUNYCODE-SUCCESS--CAPS"></a><span class="term"><code class="literal">PUNYCODE_SUCCESS</code></span></p></td>
<td> 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.
</td>
</tr>
<tr>
<td><p><a name="PUNYCODE-BAD-INPUT--CAPS"></a><span class="term"><code class="literal">PUNYCODE_BAD_INPUT</code></span></p></td>
<td> Input is invalid.
</td>
</tr>
<tr>
<td><p><a name="PUNYCODE-BIG-OUTPUT--CAPS"></a><span class="term"><code class="literal">PUNYCODE_BIG_OUTPUT</code></span></p></td>
<td> Output would exceed the space provided.
</td>
</tr>
<tr>
<td><p><a name="PUNYCODE-OVERFLOW--CAPS"></a><span class="term"><code class="literal">PUNYCODE_OVERFLOW</code></span></p></td>
<td> Input needs wider integers to process.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="punycode_strerror ()">
<a name="punycode-strerror"></a><h3>punycode_strerror ()</h3>
<pre class="programlisting">const char * punycode_strerror (<a class="link" href="libidn-punycode.html#Punycode-status" title="enum Punycode_status">Punycode_status</a> rc);</pre>
<p>
Convert a return code integer to a text string. This string can be
used to output a diagnostic message to the user.
</p>
<p>
PUNYCODE_SUCCESS: 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.
PUNYCODE_BAD_INPUT: Input is invalid.
PUNYCODE_BIG_OUTPUT: Output would exceed the space provided.
PUNYCODE_OVERFLOW: Input needs wider integers to process.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>rc</code></em> :</span></p></td>
<td> an <a class="link" href="libidn-punycode.html#Punycode-status" title="enum Punycode_status"><span class="type">Punycode_status</span></a> return code.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> Returns a pointer to a statically allocated string
containing a description of the error with the return code <em class="parameter"><code>rc</code></em>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="punycode_uint">
<a name="punycode-uint"></a><h3>punycode_uint</h3>
<pre class="programlisting"> typedef uint32_t punycode_uint;
</pre>
<p>
Unicode code point data type, this is always a 32 bit unsigned
integer.</p>
<p>
</p>
</div>
<hr>
<div class="refsect2" title="punycode_encode ()">
<a name="punycode-encode"></a><h3>punycode_encode ()</h3>
<pre class="programlisting">int punycode_encode (size_t input_length,
const <a class="link" href="libidn-punycode.html#punycode-uint" title="punycode_uint">punycode_uint</a> input[],
unsigned char case_flags[],
size_t *output_length,
char output[]);</pre>
<p>
Converts a sequence of code points (presumed to be Unicode code
points) to Punycode.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>input_length</code></em> :</span></p></td>
<td> The number of code points in the <em class="parameter"><code>input</code></em> array and
the number of flags in the <em class="parameter"><code>case_flags</code></em> array.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>input</code></em> :</span></p></td>
<td> 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.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>case_flags</code></em> :</span></p></td>
<td> A <code class="literal">NULL</code> pointer or an array of boolean values parallel
to the <em class="parameter"><code>input</code></em> 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 <em class="parameter"><code>case_flags</code></em> is a <code class="literal">NULL</code> pointer then ASCII letters
are left as they are, and other code points are treated as
unflagged.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>output_length</code></em> :</span></p></td>
<td> 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.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>output</code></em> :</span></p></td>
<td> An array of ASCII code points. It is *not*
null-terminated; it will contain zeros if and only if the <em class="parameter"><code>input</code></em>
contains zeros. (Of course the caller can leave room for a
terminator and add one if needed.)
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> The return value can be any of the <a class="link" href="libidn-punycode.html#Punycode-status" title="enum Punycode_status"><span class="type">Punycode_status</span></a>
values defined above except <a class="link" href="libidn-punycode.html#PUNYCODE-BAD-INPUT--CAPS"><code class="literal">PUNYCODE_BAD_INPUT</code></a>. If not
<a class="link" href="libidn-punycode.html#PUNYCODE-SUCCESS--CAPS"><code class="literal">PUNYCODE_SUCCESS</code></a>, then <em class="parameter"><code>output_size</code></em> and <em class="parameter"><code>output</code></em> might contain
garbage.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="punycode_decode ()">
<a name="punycode-decode"></a><h3>punycode_decode ()</h3>
<pre class="programlisting">int punycode_decode (size_t input_length,
const char input[],
size_t *output_length,
<a class="link" href="libidn-punycode.html#punycode-uint" title="punycode_uint">punycode_uint</a> output[],
unsigned char case_flags[]);</pre>
<p>
Converts Punycode to a sequence of code points (presumed to be
Unicode code points).</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>input_length</code></em> :</span></p></td>
<td> The number of ASCII code points in the <em class="parameter"><code>input</code></em> array.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>input</code></em> :</span></p></td>
<td> An array of ASCII code points (0..7F).
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>output_length</code></em> :</span></p></td>
<td> The caller passes in the maximum number of code
points that it can receive into the <em class="parameter"><code>output</code></em> array (which is also
the maximum number of flags that it can receive into the
<em class="parameter"><code>case_flags</code></em> array, if <em class="parameter"><code>case_flags</code></em> is not a <code class="literal">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
<em class="parameter"><code>output_length</code></em> is greater than that.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>output</code></em> :</span></p></td>
<td> An array of code points like the input argument of
<a class="link" href="libidn-punycode.html#punycode-encode" title="punycode_encode ()"><code class="function">punycode_encode()</code></a> (see above).
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>case_flags</code></em> :</span></p></td>
<td> A <code class="literal">NULL</code> pointer (if the flags are not needed by the
caller) or an array of boolean values parallel to the <em class="parameter"><code>output</code></em>
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.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> The return value can be any of the <a class="link" href="libidn-punycode.html#Punycode-status" title="enum Punycode_status"><span class="type">Punycode_status</span></a>
values defined above. If not <a class="link" href="libidn-punycode.html#PUNYCODE-SUCCESS--CAPS"><code class="literal">PUNYCODE_SUCCESS</code></a>, then
<em class="parameter"><code>output_length</code></em>, <em class="parameter"><code>output</code></em>, and <em class="parameter"><code>case_flags</code></em> might contain garbage.
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.11</div>
</body>
</html>
|