File size: 32,107 Bytes
53a37cf | 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 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 | <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>encoding: interface for the encoding conversion functions</title>
<meta name="generator" content="Libxml2 devhelp stylesheet">
<link rel="start" href="index.html" title="libxml2 Reference Manual">
<link rel="up" href="general.html" title="API">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="general.html" title="API">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
<td><a accesskey="p" href="libxml2-dict.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="general.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>
<td><a accesskey="n" href="libxml2-entities.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
<th width="100%" align="center">libxml2 Reference Manual</th>
</tr></table>
<h2><span class="refentrytitle">encoding</span></h2>
<p>encoding - interface for the encoding conversion functions</p>
<p>interface for the encoding conversion functions needed for XML basic encoding and iconv() support. Related specs are rfc2044 (UTF-8 and UTF-16) F. Yergeau Alis Technologies [ISO-10646] UTF-8 and UTF-16 in Annexes [ISO-8859-1] ISO Latin-1 characters codes. [UNICODE] The Unicode Consortium, "The Unicode Standard -- Worldwide Character Encoding -- Version 1.0", Addison- Wesley, Volume 1, 1991, Volume 2, 1992. UTF-8 is described in Unicode Technical Report #4. [US-ASCII] Coded Character Set--7-bit American Standard Code for Information Interchange, ANSI X3.4-1986. </p>
<p>Author(s): Daniel Veillard </p>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">typedef enum <a href="#xmlCharEncError">xmlCharEncError</a>;
typedef enum <a href="#xmlCharEncoding">xmlCharEncoding</a>;
typedef struct _xmlCharEncodingHandler <a href="#xmlCharEncodingHandler">xmlCharEncodingHandler</a>;
typedef <a href="libxml2-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a> * <a href="#xmlCharEncodingHandlerPtr">xmlCharEncodingHandlerPtr</a>;
int <a href="#UTF8Toisolat1">UTF8Toisolat1</a> (unsigned char * out, <br> int * outlen, <br> const unsigned char * in, <br> int * inlen);
int <a href="#isolat1ToUTF8">isolat1ToUTF8</a> (unsigned char * out, <br> int * outlen, <br> const unsigned char * in, <br> int * inlen);
int <a href="#xmlAddEncodingAlias">xmlAddEncodingAlias</a> (const char * name, <br> const char * alias);
int <a href="#xmlCharEncCloseFunc">xmlCharEncCloseFunc</a> (<a href="libxml2-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a> * handler);
int <a href="#xmlCharEncFirstLine">xmlCharEncFirstLine</a> (<a href="libxml2-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a> * handler, <br> <a href="libxml2-tree.html#xmlBufferPtr">xmlBufferPtr</a> out, <br> <a href="libxml2-tree.html#xmlBufferPtr">xmlBufferPtr</a> in);
int <a href="#xmlCharEncInFunc">xmlCharEncInFunc</a> (<a href="libxml2-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a> * handler, <br> <a href="libxml2-tree.html#xmlBufferPtr">xmlBufferPtr</a> out, <br> <a href="libxml2-tree.html#xmlBufferPtr">xmlBufferPtr</a> in);
int <a href="#xmlCharEncOutFunc">xmlCharEncOutFunc</a> (<a href="libxml2-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a> * handler, <br> <a href="libxml2-tree.html#xmlBufferPtr">xmlBufferPtr</a> out, <br> <a href="libxml2-tree.html#xmlBufferPtr">xmlBufferPtr</a> in);
typedef int <a href="#xmlCharEncodingInputFunc">xmlCharEncodingInputFunc</a> (unsigned char * out, <br> int * outlen, <br> const unsigned char * in, <br> int * inlen);
typedef int <a href="#xmlCharEncodingOutputFunc">xmlCharEncodingOutputFunc</a> (unsigned char * out, <br> int * outlen, <br> const unsigned char * in, <br> int * inlen);
void <a href="#xmlCleanupCharEncodingHandlers">xmlCleanupCharEncodingHandlers</a> (void);
void <a href="#xmlCleanupEncodingAliases">xmlCleanupEncodingAliases</a> (void);
int <a href="#xmlDelEncodingAlias">xmlDelEncodingAlias</a> (const char * alias);
<a href="libxml2-encoding.html#xmlCharEncoding">xmlCharEncoding</a> <a href="#xmlDetectCharEncoding">xmlDetectCharEncoding</a> (const unsigned char * in, <br> int len);
<a href="libxml2-encoding.html#xmlCharEncodingHandlerPtr">xmlCharEncodingHandlerPtr</a> <a href="#xmlFindCharEncodingHandler">xmlFindCharEncodingHandler</a> (const char * name);
<a href="libxml2-encoding.html#xmlCharEncodingHandlerPtr">xmlCharEncodingHandlerPtr</a> <a href="#xmlGetCharEncodingHandler">xmlGetCharEncodingHandler</a> (<a href="libxml2-encoding.html#xmlCharEncoding">xmlCharEncoding</a> enc);
const char * <a href="#xmlGetCharEncodingName">xmlGetCharEncodingName</a> (<a href="libxml2-encoding.html#xmlCharEncoding">xmlCharEncoding</a> enc);
const char * <a href="#xmlGetEncodingAlias">xmlGetEncodingAlias</a> (const char * alias);
void <a href="#xmlInitCharEncodingHandlers">xmlInitCharEncodingHandlers</a> (void);
int <a href="#xmlLookupCharEncodingHandler">xmlLookupCharEncodingHandler</a> (<a href="libxml2-encoding.html#xmlCharEncoding">xmlCharEncoding</a> enc, <br> <a href="libxml2-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a> ** out);
<a href="libxml2-encoding.html#xmlCharEncodingHandlerPtr">xmlCharEncodingHandlerPtr</a> <a href="#xmlNewCharEncodingHandler">xmlNewCharEncodingHandler</a> (const char * name, <br> <a href="libxml2-encoding.html#xmlCharEncodingInputFunc">xmlCharEncodingInputFunc</a> input, <br> <a href="libxml2-encoding.html#xmlCharEncodingOutputFunc">xmlCharEncodingOutputFunc</a> output);
int <a href="#xmlOpenCharEncodingHandler">xmlOpenCharEncodingHandler</a> (const char * name, <br> int output, <br> <a href="libxml2-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a> ** out);
<a href="libxml2-encoding.html#xmlCharEncoding">xmlCharEncoding</a> <a href="#xmlParseCharEncoding">xmlParseCharEncoding</a> (const char * name);
void <a href="#xmlRegisterCharEncodingHandler">xmlRegisterCharEncodingHandler</a> (<a href="libxml2-encoding.html#xmlCharEncodingHandlerPtr">xmlCharEncodingHandlerPtr</a> handler);
</pre>
</div>
<div class="refsect1" lang="en"><h2>Description</h2></div>
<div class="refsect1" lang="en">
<h2>Details</h2>
<div class="refsect2" lang="en">
<div class="refsect2" lang="en">
<h3>
<a name="xmlCharEncError">Enum </a>xmlCharEncError</h3>
<pre class="programlisting">enum <a href="#xmlCharEncError">xmlCharEncError</a> {
<a name="XML_ENC_ERR_MEMORY">XML_ENC_ERR_MEMORY</a> = -5
<a name="XML_ENC_ERR_INTERNAL">XML_ENC_ERR_INTERNAL</a> = -4
<a name="XML_ENC_ERR_PARTIAL">XML_ENC_ERR_PARTIAL</a> = -3
<a name="XML_ENC_ERR_INPUT">XML_ENC_ERR_INPUT</a> = -2
<a name="XML_ENC_ERR_SPACE">XML_ENC_ERR_SPACE</a> = -1
<a name="XML_ENC_ERR_SUCCESS">XML_ENC_ERR_SUCCESS</a> = 0
};
</pre>
<p></p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlCharEncoding">Enum </a>xmlCharEncoding</h3>
<pre class="programlisting">enum <a href="#xmlCharEncoding">xmlCharEncoding</a> {
<a name="XML_CHAR_ENCODING_ERROR">XML_CHAR_ENCODING_ERROR</a> = -1 /* No char encoding detected */
<a name="XML_CHAR_ENCODING_NONE">XML_CHAR_ENCODING_NONE</a> = 0 /* No char encoding detected */
<a name="XML_CHAR_ENCODING_UTF8">XML_CHAR_ENCODING_UTF8</a> = 1 /* UTF-8 */
<a name="XML_CHAR_ENCODING_UTF16LE">XML_CHAR_ENCODING_UTF16LE</a> = 2 /* UTF-16 little endian */
<a name="XML_CHAR_ENCODING_UTF16BE">XML_CHAR_ENCODING_UTF16BE</a> = 3 /* UTF-16 big endian */
<a name="XML_CHAR_ENCODING_UCS4LE">XML_CHAR_ENCODING_UCS4LE</a> = 4 /* UCS-4 little endian */
<a name="XML_CHAR_ENCODING_UCS4BE">XML_CHAR_ENCODING_UCS4BE</a> = 5 /* UCS-4 big endian */
<a name="XML_CHAR_ENCODING_EBCDIC">XML_CHAR_ENCODING_EBCDIC</a> = 6 /* EBCDIC uh! */
<a name="XML_CHAR_ENCODING_UCS4_2143">XML_CHAR_ENCODING_UCS4_2143</a> = 7 /* UCS-4 unusual ordering */
<a name="XML_CHAR_ENCODING_UCS4_3412">XML_CHAR_ENCODING_UCS4_3412</a> = 8 /* UCS-4 unusual ordering */
<a name="XML_CHAR_ENCODING_UCS2">XML_CHAR_ENCODING_UCS2</a> = 9 /* UCS-2 */
<a name="XML_CHAR_ENCODING_8859_1">XML_CHAR_ENCODING_8859_1</a> = 10 /* ISO-8859-1 ISO Latin 1 */
<a name="XML_CHAR_ENCODING_8859_2">XML_CHAR_ENCODING_8859_2</a> = 11 /* ISO-8859-2 ISO Latin 2 */
<a name="XML_CHAR_ENCODING_8859_3">XML_CHAR_ENCODING_8859_3</a> = 12 /* ISO-8859-3 */
<a name="XML_CHAR_ENCODING_8859_4">XML_CHAR_ENCODING_8859_4</a> = 13 /* ISO-8859-4 */
<a name="XML_CHAR_ENCODING_8859_5">XML_CHAR_ENCODING_8859_5</a> = 14 /* ISO-8859-5 */
<a name="XML_CHAR_ENCODING_8859_6">XML_CHAR_ENCODING_8859_6</a> = 15 /* ISO-8859-6 */
<a name="XML_CHAR_ENCODING_8859_7">XML_CHAR_ENCODING_8859_7</a> = 16 /* ISO-8859-7 */
<a name="XML_CHAR_ENCODING_8859_8">XML_CHAR_ENCODING_8859_8</a> = 17 /* ISO-8859-8 */
<a name="XML_CHAR_ENCODING_8859_9">XML_CHAR_ENCODING_8859_9</a> = 18 /* ISO-8859-9 */
<a name="XML_CHAR_ENCODING_2022_JP">XML_CHAR_ENCODING_2022_JP</a> = 19 /* ISO-2022-JP */
<a name="XML_CHAR_ENCODING_SHIFT_JIS">XML_CHAR_ENCODING_SHIFT_JIS</a> = 20 /* Shift_JIS */
<a name="XML_CHAR_ENCODING_EUC_JP">XML_CHAR_ENCODING_EUC_JP</a> = 21 /* EUC-JP */
<a name="XML_CHAR_ENCODING_ASCII">XML_CHAR_ENCODING_ASCII</a> = 22 /* pure ASCII */
};
</pre>
<p></p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlCharEncodingHandler">Structure </a>xmlCharEncodingHandler</h3>
<pre class="programlisting">struct _xmlCharEncodingHandler {
char * name
<a href="libxml2-encoding.html#xmlCharEncodingInputFunc">xmlCharEncodingInputFunc</a> input
<a href="libxml2-encoding.html#xmlCharEncodingOutputFunc">xmlCharEncodingOutputFunc</a> output
iconv_t iconv_in
iconv_t iconv_out
struct _uconv_t * uconv_in
struct _uconv_t * uconv_out
} xmlCharEncodingHandler;
</pre>
<p></p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlCharEncodingHandlerPtr">Typedef </a>xmlCharEncodingHandlerPtr</h3>
<pre class="programlisting"><a href="libxml2-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a> * xmlCharEncodingHandlerPtr;
</pre>
<p></p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlCharEncodingInputFunc"></a>Function type xmlCharEncodingInputFunc</h3>
<pre class="programlisting">int xmlCharEncodingInputFunc (unsigned char * out, <br> int * outlen, <br> const unsigned char * in, <br> int * inlen)<br>
</pre>
<p>Take a block of chars in the original encoding and try to convert it to an UTF-8 block of chars out.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>out</tt></i>:</span></td>
<td>a pointer to an array of bytes to store the UTF-8 result</td>
</tr>
<tr>
<td><span class="term"><i><tt>outlen</tt></i>:</span></td>
<td>the length of @out</td>
</tr>
<tr>
<td><span class="term"><i><tt>in</tt></i>:</span></td>
<td>a pointer to an array of chars in the original encoding</td>
</tr>
<tr>
<td><span class="term"><i><tt>inlen</tt></i>:</span></td>
<td>the length of @in</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the number of bytes written, -1 if lack of space, or -2 if the transcoding failed. The value of @inlen after return is the number of octets consumed if the return value is positive, else unpredictiable. The value of @outlen after return is the number of octets consumed.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlCharEncodingOutputFunc"></a>Function type xmlCharEncodingOutputFunc</h3>
<pre class="programlisting">int xmlCharEncodingOutputFunc (unsigned char * out, <br> int * outlen, <br> const unsigned char * in, <br> int * inlen)<br>
</pre>
<p>Take a block of UTF-8 chars in and try to convert it to another encoding. Note: a first call designed to produce heading info is called with in = NULL. If stateful this should also initialize the encoder state.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>out</tt></i>:</span></td>
<td>a pointer to an array of bytes to store the result</td>
</tr>
<tr>
<td><span class="term"><i><tt>outlen</tt></i>:</span></td>
<td>the length of @out</td>
</tr>
<tr>
<td><span class="term"><i><tt>in</tt></i>:</span></td>
<td>a pointer to an array of UTF-8 chars</td>
</tr>
<tr>
<td><span class="term"><i><tt>inlen</tt></i>:</span></td>
<td>the length of @in</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the number of bytes written, -1 if lack of space, or -2 if the transcoding failed. The value of @inlen after return is the number of octets consumed if the return value is positive, else unpredictiable. The value of @outlen after return is the number of octets produced.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="UTF8Toisolat1"></a>UTF8Toisolat1 ()</h3>
<pre class="programlisting">int UTF8Toisolat1 (unsigned char * out, <br> int * outlen, <br> const unsigned char * in, <br> int * inlen)<br>
</pre>
<p>Take a block of UTF-8 chars in and try to convert it to an ISO Latin 1 block of chars out.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>out</tt></i>:</span></td>
<td>a pointer to an array of bytes to store the result</td>
</tr>
<tr>
<td><span class="term"><i><tt>outlen</tt></i>:</span></td>
<td>the length of @out</td>
</tr>
<tr>
<td><span class="term"><i><tt>in</tt></i>:</span></td>
<td>a pointer to an array of UTF-8 chars</td>
</tr>
<tr>
<td><span class="term"><i><tt>inlen</tt></i>:</span></td>
<td>the length of @in</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the number of bytes written or an XML_ENC_ERR code. The value of @inlen after return is the number of octets consumed if the return value is positive, else unpredictable. The value of @outlen after return is the number of octets produced.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="isolat1ToUTF8"></a>isolat1ToUTF8 ()</h3>
<pre class="programlisting">int isolat1ToUTF8 (unsigned char * out, <br> int * outlen, <br> const unsigned char * in, <br> int * inlen)<br>
</pre>
<p>Take a block of ISO Latin 1 chars in and try to convert it to an UTF-8 block of chars out.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>out</tt></i>:</span></td>
<td>a pointer to an array of bytes to store the result</td>
</tr>
<tr>
<td><span class="term"><i><tt>outlen</tt></i>:</span></td>
<td>the length of @out</td>
</tr>
<tr>
<td><span class="term"><i><tt>in</tt></i>:</span></td>
<td>a pointer to an array of ISO Latin 1 chars</td>
</tr>
<tr>
<td><span class="term"><i><tt>inlen</tt></i>:</span></td>
<td>the length of @in</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the number of bytes written or an XML_ENC_ERR code. The value of @inlen after return is the number of octets consumed if the return value is positive, else unpredictable. The value of @outlen after return is the number of octets produced.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlAddEncodingAlias"></a>xmlAddEncodingAlias ()</h3>
<pre class="programlisting">int xmlAddEncodingAlias (const char * name, <br> const char * alias)<br>
</pre>
<p>Registers an alias @alias for an encoding named @name. Existing alias will be overwritten.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>name</tt></i>:</span></td>
<td>the encoding name as parsed, in UTF-8 format (ASCII actually)</td>
</tr>
<tr>
<td><span class="term"><i><tt>alias</tt></i>:</span></td>
<td>the alias name as parsed, in UTF-8 format (ASCII actually)</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>0 in case of success, -1 in case of error</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlCharEncCloseFunc"></a>xmlCharEncCloseFunc ()</h3>
<pre class="programlisting">int xmlCharEncCloseFunc (<a href="libxml2-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a> * handler)<br>
</pre>
<p>Generic front-end for encoding handler close function</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>handler</tt></i>:</span></td>
<td>char encoding transformation data structure</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>0 if success, or -1 in case of error</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlCharEncFirstLine"></a>xmlCharEncFirstLine ()</h3>
<pre class="programlisting">int xmlCharEncFirstLine (<a href="libxml2-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a> * handler, <br> <a href="libxml2-tree.html#xmlBufferPtr">xmlBufferPtr</a> out, <br> <a href="libxml2-tree.html#xmlBufferPtr">xmlBufferPtr</a> in)<br>
</pre>
<p>DEPERECATED: Don't use.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>handler</tt></i>:</span></td>
<td>char encoding transformation data structure</td>
</tr>
<tr>
<td><span class="term"><i><tt>out</tt></i>:</span></td>
<td>an <a href="libxml2-tree.html#xmlBuffer">xmlBuffer</a> for the output.</td>
</tr>
<tr>
<td><span class="term"><i><tt>in</tt></i>:</span></td>
<td>an <a href="libxml2-tree.html#xmlBuffer">xmlBuffer</a> for the input</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the number of bytes written or an XML_ENC_ERR code.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlCharEncInFunc"></a>xmlCharEncInFunc ()</h3>
<pre class="programlisting">int xmlCharEncInFunc (<a href="libxml2-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a> * handler, <br> <a href="libxml2-tree.html#xmlBufferPtr">xmlBufferPtr</a> out, <br> <a href="libxml2-tree.html#xmlBufferPtr">xmlBufferPtr</a> in)<br>
</pre>
<p>Generic front-end for the encoding handler input function</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>handler</tt></i>:</span></td>
<td>char encoding transformation data structure</td>
</tr>
<tr>
<td><span class="term"><i><tt>out</tt></i>:</span></td>
<td>an <a href="libxml2-tree.html#xmlBuffer">xmlBuffer</a> for the output.</td>
</tr>
<tr>
<td><span class="term"><i><tt>in</tt></i>:</span></td>
<td>an <a href="libxml2-tree.html#xmlBuffer">xmlBuffer</a> for the input</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the number of bytes written or an XML_ENC_ERR code.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlCharEncOutFunc"></a>xmlCharEncOutFunc ()</h3>
<pre class="programlisting">int xmlCharEncOutFunc (<a href="libxml2-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a> * handler, <br> <a href="libxml2-tree.html#xmlBufferPtr">xmlBufferPtr</a> out, <br> <a href="libxml2-tree.html#xmlBufferPtr">xmlBufferPtr</a> in)<br>
</pre>
<p>Generic front-end for the encoding handler output function a first call with @in == NULL has to be made firs to initiate the output in case of non-stateless encoding needing to initiate their state or the output (like the BOM in UTF16). In case of UTF8 sequence conversion errors for the given encoder, the content will be automatically remapped to a CharRef sequence.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>handler</tt></i>:</span></td>
<td>char encoding transformation data structure</td>
</tr>
<tr>
<td><span class="term"><i><tt>out</tt></i>:</span></td>
<td>an <a href="libxml2-tree.html#xmlBuffer">xmlBuffer</a> for the output.</td>
</tr>
<tr>
<td><span class="term"><i><tt>in</tt></i>:</span></td>
<td>an <a href="libxml2-tree.html#xmlBuffer">xmlBuffer</a> for the input</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the number of bytes written or an XML_ENC_ERR code.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlCleanupCharEncodingHandlers"></a>xmlCleanupCharEncodingHandlers ()</h3>
<pre class="programlisting">void xmlCleanupCharEncodingHandlers (void)<br>
</pre>
<p>DEPRECATED: This function will be made private. Call <a href="libxml2-parser.html#xmlCleanupParser">xmlCleanupParser</a> to free global state but see the warnings there. <a href="libxml2-parser.html#xmlCleanupParser">xmlCleanupParser</a> should be only called once at program exit. In most cases, you don't have call cleanup functions at all. Cleanup the memory allocated for the char encoding support, it unregisters all the encoding handlers and the aliases.</p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlCleanupEncodingAliases"></a>xmlCleanupEncodingAliases ()</h3>
<pre class="programlisting">void xmlCleanupEncodingAliases (void)<br>
</pre>
<p>Unregisters all aliases</p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlDelEncodingAlias"></a>xmlDelEncodingAlias ()</h3>
<pre class="programlisting">int xmlDelEncodingAlias (const char * alias)<br>
</pre>
<p>Unregisters an encoding alias @alias</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>alias</tt></i>:</span></td>
<td>the alias name as parsed, in UTF-8 format (ASCII actually)</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>0 in case of success, -1 in case of error</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlDetectCharEncoding"></a>xmlDetectCharEncoding ()</h3>
<pre class="programlisting"><a href="libxml2-encoding.html#xmlCharEncoding">xmlCharEncoding</a> xmlDetectCharEncoding (const unsigned char * in, <br> int len)<br>
</pre>
<p>Guess the encoding of the entity using the first bytes of the entity content according to the non-normative appendix F of the XML-1.0 recommendation.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>in</tt></i>:</span></td>
<td>a pointer to the first bytes of the XML entity, must be at least 2 bytes long (at least 4 if encoding is UTF4 variant).</td>
</tr>
<tr>
<td><span class="term"><i><tt>len</tt></i>:</span></td>
<td>pointer to the length of the buffer</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>one of the XML_CHAR_ENCODING_... values.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlFindCharEncodingHandler"></a>xmlFindCharEncodingHandler ()</h3>
<pre class="programlisting"><a href="libxml2-encoding.html#xmlCharEncodingHandlerPtr">xmlCharEncodingHandlerPtr</a> xmlFindCharEncodingHandler (const char * name)<br>
</pre>
<p>DEPRECATED: Use <a href="libxml2-encoding.html#xmlOpenCharEncodingHandler">xmlOpenCharEncodingHandler</a> which has better error reporting.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>name</tt></i>:</span></td>
<td>a string describing the char encoding.</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the handler or NULL if no handler was found or an error occurred.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlGetCharEncodingHandler"></a>xmlGetCharEncodingHandler ()</h3>
<pre class="programlisting"><a href="libxml2-encoding.html#xmlCharEncodingHandlerPtr">xmlCharEncodingHandlerPtr</a> xmlGetCharEncodingHandler (<a href="libxml2-encoding.html#xmlCharEncoding">xmlCharEncoding</a> enc)<br>
</pre>
<p>DEPRECATED: Use <a href="libxml2-encoding.html#xmlLookupCharEncodingHandler">xmlLookupCharEncodingHandler</a> which has better error reporting.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>enc</tt></i>:</span></td>
<td>an <a href="libxml2-encoding.html#xmlCharEncoding">xmlCharEncoding</a> value.</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the handler or NULL if no handler was found or an error occurred.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlGetCharEncodingName"></a>xmlGetCharEncodingName ()</h3>
<pre class="programlisting">const char * xmlGetCharEncodingName (<a href="libxml2-encoding.html#xmlCharEncoding">xmlCharEncoding</a> enc)<br>
</pre>
<p>The "canonical" name for XML encoding. C.f. http://www.w3.org/TR/REC-xml#charencoding Section 4.3.3 Character Encoding in Entities</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>enc</tt></i>:</span></td>
<td>the encoding</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the canonical name for the given encoding</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlGetEncodingAlias"></a>xmlGetEncodingAlias ()</h3>
<pre class="programlisting">const char * xmlGetEncodingAlias (const char * alias)<br>
</pre>
<p>Lookup an encoding name for the given alias.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>alias</tt></i>:</span></td>
<td>the alias name as parsed, in UTF-8 format (ASCII actually)</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>NULL if not found, otherwise the original name</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlInitCharEncodingHandlers"></a>xmlInitCharEncodingHandlers ()</h3>
<pre class="programlisting">void xmlInitCharEncodingHandlers (void)<br>
</pre>
<p>DEPRECATED: Alias for <a href="libxml2-parser.html#xmlInitParser">xmlInitParser</a>.</p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlLookupCharEncodingHandler"></a>xmlLookupCharEncodingHandler ()</h3>
<pre class="programlisting">int xmlLookupCharEncodingHandler (<a href="libxml2-encoding.html#xmlCharEncoding">xmlCharEncoding</a> enc, <br> <a href="libxml2-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a> ** out)<br>
</pre>
<p>Find or create a handler matching the encoding. If no default or registered handler could be found, try to create a handler using iconv or ICU if supported. The handler must be closed with <a href="libxml2-encoding.html#xmlCharEncCloseFunc">xmlCharEncCloseFunc</a>. Available since 2.13.0.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>enc</tt></i>:</span></td>
<td>an <a href="libxml2-encoding.html#xmlCharEncoding">xmlCharEncoding</a> value.</td>
</tr>
<tr>
<td><span class="term"><i><tt>out</tt></i>:</span></td>
<td>pointer to result</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>an <a href="libxml2-xmlerror.html#xmlParserErrors">xmlParserErrors</a> error code.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlNewCharEncodingHandler"></a>xmlNewCharEncodingHandler ()</h3>
<pre class="programlisting"><a href="libxml2-encoding.html#xmlCharEncodingHandlerPtr">xmlCharEncodingHandlerPtr</a> xmlNewCharEncodingHandler (const char * name, <br> <a href="libxml2-encoding.html#xmlCharEncodingInputFunc">xmlCharEncodingInputFunc</a> input, <br> <a href="libxml2-encoding.html#xmlCharEncodingOutputFunc">xmlCharEncodingOutputFunc</a> output)<br>
</pre>
<p>Create and registers an <a href="libxml2-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a>.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>name</tt></i>:</span></td>
<td>the encoding name, in UTF-8 format (ASCII actually)</td>
</tr>
<tr>
<td><span class="term"><i><tt>input</tt></i>:</span></td>
<td>the <a href="libxml2-encoding.html#xmlCharEncodingInputFunc">xmlCharEncodingInputFunc</a> to read that encoding</td>
</tr>
<tr>
<td><span class="term"><i><tt>output</tt></i>:</span></td>
<td>the <a href="libxml2-encoding.html#xmlCharEncodingOutputFunc">xmlCharEncodingOutputFunc</a> to write that encoding</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the <a href="libxml2-encoding.html#xmlCharEncodingHandlerPtr">xmlCharEncodingHandlerPtr</a> created (or NULL in case of error).</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlOpenCharEncodingHandler"></a>xmlOpenCharEncodingHandler ()</h3>
<pre class="programlisting">int xmlOpenCharEncodingHandler (const char * name, <br> int output, <br> <a href="libxml2-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a> ** out)<br>
</pre>
<p>Find or create a handler matching the encoding. If no default or registered handler could be found, try to create a handler using iconv or ICU if supported. The handler must be closed with <a href="libxml2-encoding.html#xmlCharEncCloseFunc">xmlCharEncCloseFunc</a>. Available since 2.13.0.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>name</tt></i>:</span></td>
<td>a string describing the char encoding.</td>
</tr>
<tr>
<td><span class="term"><i><tt>output</tt></i>:</span></td>
<td>boolean, use handler for output</td>
</tr>
<tr>
<td><span class="term"><i><tt>out</tt></i>:</span></td>
<td>pointer to result</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>an <a href="libxml2-xmlerror.html#xmlParserErrors">xmlParserErrors</a> error code.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlParseCharEncoding"></a>xmlParseCharEncoding ()</h3>
<pre class="programlisting"><a href="libxml2-encoding.html#xmlCharEncoding">xmlCharEncoding</a> xmlParseCharEncoding (const char * name)<br>
</pre>
<p>Compare the string to the encoding schemes already known. Note that the comparison is case insensitive accordingly to the section [XML] 4.3.3 Character Encoding in Entities.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>name</tt></i>:</span></td>
<td>the encoding name as parsed, in UTF-8 format (ASCII actually)</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>one of the XML_CHAR_ENCODING_... values or <a href="libxml2-encoding.html#XML_CHAR_ENCODING_NONE">XML_CHAR_ENCODING_NONE</a> if not recognized.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlRegisterCharEncodingHandler"></a>xmlRegisterCharEncodingHandler ()</h3>
<pre class="programlisting">void xmlRegisterCharEncodingHandler (<a href="libxml2-encoding.html#xmlCharEncodingHandlerPtr">xmlCharEncodingHandlerPtr</a> handler)<br>
</pre>
<p>Register the char encoding handler, surprising, isn't it ?</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody><tr>
<td><span class="term"><i><tt>handler</tt></i>:</span></td>
<td>the <a href="libxml2-encoding.html#xmlCharEncodingHandlerPtr">xmlCharEncodingHandlerPtr</a> handler block</td>
</tr></tbody>
</table></div>
</div>
<hr>
</div>
</div>
</body>
</html>
|