libxml2/doc/devhelp/libxml2-encoding.html
2025-03-27 15:17:22 +01:00

883 lines
43 KiB
HTML

<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">#define <a href="#UTF8Toisolat1">UTF8Toisolat1</a>;
#define <a href="#isolat1ToUTF8">isolat1ToUTF8</a>;
typedef enum <a href="#xmlCharEncError">xmlCharEncError</a>;
typedef enum <a href="#xmlCharEncFlags">xmlCharEncFlags</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="#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);
typedef void <a href="#xmlCharEncConvCtxtDtor">xmlCharEncConvCtxtDtor</a> (void * vctxt);
typedef <a href="libxml2-encoding.html#xmlCharEncError">xmlCharEncError</a> <a href="#xmlCharEncConvFunc">xmlCharEncConvFunc</a> (void * vctxt, <br> unsigned char * out, <br> int * outlen, <br> const unsigned char * in, <br> int * inlen, <br> int flush);
typedef <a href="libxml2-xmlerror.html#xmlParserErrors">xmlParserErrors</a> <a href="#xmlCharEncConvImpl">xmlCharEncConvImpl</a> (void * vctxt, <br> const char * name, <br> <a href="libxml2-encoding.html#xmlCharEncFlags">xmlCharEncFlags</a> flags, <br> <a href="libxml2-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a> ** out);
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);
<a href="libxml2-xmlerror.html#xmlParserErrors">xmlParserErrors</a> <a href="#xmlCharEncNewCustomHandler">xmlCharEncNewCustomHandler</a> (const char * name, <br> <a href="libxml2-encoding.html#xmlCharEncConvFunc">xmlCharEncConvFunc</a> input, <br> <a href="libxml2-encoding.html#xmlCharEncConvFunc">xmlCharEncConvFunc</a> output, <br> <a href="libxml2-encoding.html#xmlCharEncConvCtxtDtor">xmlCharEncConvCtxtDtor</a> ctxtDtor, <br> void * inputCtxt, <br> void * outputCtxt, <br> <a href="libxml2-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a> ** out);
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);
<a href="libxml2-xmlerror.html#xmlParserErrors">xmlParserErrors</a> <a href="#xmlCreateCharEncodingHandler">xmlCreateCharEncodingHandler</a> (const char * name, <br> <a href="libxml2-encoding.html#xmlCharEncFlags">xmlCharEncFlags</a> flags, <br> <a href="libxml2-encoding.html#xmlCharEncConvImpl">xmlCharEncConvImpl</a> impl, <br> void * implCtxt, <br> <a href="libxml2-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a> ** out);
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="#xmlIsolat1ToUTF8">xmlIsolat1ToUTF8</a> (unsigned char * out, <br> int * outlen, <br> const unsigned char * in, <br> int * inlen);
<a href="libxml2-xmlerror.html#xmlParserErrors">xmlParserErrors</a> <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);
<a href="libxml2-xmlerror.html#xmlParserErrors">xmlParserErrors</a> <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);
int <a href="#xmlUTF8ToIsolat1">xmlUTF8ToIsolat1</a> (unsigned char * out, <br> int * outlen, <br> const unsigned char * in, <br> int * inlen);
</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="UTF8Toisolat1">Macro </a>UTF8Toisolat1</h3>
<pre class="programlisting">#define <a href="#UTF8Toisolat1">UTF8Toisolat1</a>;
</pre>
<p></p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="isolat1ToUTF8">Macro </a>isolat1ToUTF8</h3>
<pre class="programlisting">#define <a href="#isolat1ToUTF8">isolat1ToUTF8</a>;
</pre>
<p></p>
</div>
<hr>
<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> = -4
<a name="XML_ENC_ERR_SPACE">XML_ENC_ERR_SPACE</a> = -3
<a name="XML_ENC_ERR_INPUT">XML_ENC_ERR_INPUT</a> = -2
<a name="XML_ENC_ERR_INTERNAL">XML_ENC_ERR_INTERNAL</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="xmlCharEncFlags">Enum </a>xmlCharEncFlags</h3>
<pre class="programlisting">enum <a href="#xmlCharEncFlags">xmlCharEncFlags</a> {
<a name="XML_ENC_INPUT">XML_ENC_INPUT</a> = 1
<a name="XML_ENC_OUTPUT">XML_ENC_OUTPUT</a> = 2
};
</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 Available since 2.14.0 */
<a name="XML_CHAR_ENCODING_UTF16">XML_CHAR_ENCODING_UTF16</a> = 23 /* UTF-16 native */
<a name="XML_CHAR_ENCODING_HTML">XML_CHAR_ENCODING_HTML</a> = 24 /* HTML (output only) */
<a name="XML_CHAR_ENCODING_8859_10">XML_CHAR_ENCODING_8859_10</a> = 25 /* ISO-8859-10 */
<a name="XML_CHAR_ENCODING_8859_11">XML_CHAR_ENCODING_8859_11</a> = 26 /* ISO-8859-11 */
<a name="XML_CHAR_ENCODING_8859_13">XML_CHAR_ENCODING_8859_13</a> = 27 /* ISO-8859-13 */
<a name="XML_CHAR_ENCODING_8859_14">XML_CHAR_ENCODING_8859_14</a> = 28 /* ISO-8859-14 */
<a name="XML_CHAR_ENCODING_8859_15">XML_CHAR_ENCODING_8859_15</a> = 29 /* ISO-8859-15 */
<a name="XML_CHAR_ENCODING_8859_16">XML_CHAR_ENCODING_8859_16</a> = 30 /* ISO-8859-16 */
};
</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
void * inputCtxt
void * outputCtxt
<a href="libxml2-encoding.html#xmlCharEncConvCtxtDtor">xmlCharEncConvCtxtDtor</a> ctxtDtor
int flags
} 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="xmlCharEncConvCtxtDtor"></a>Function type xmlCharEncConvCtxtDtor</h3>
<pre class="programlisting">void xmlCharEncConvCtxtDtor (void * vctxt)<br>
</pre>
<p>Free a conversion context.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody><tr>
<td><span class="term"><i><tt>vctxt</tt></i>:</span></td>
<td>conversion context</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlCharEncConvFunc"></a>Function type xmlCharEncConvFunc</h3>
<pre class="programlisting"><a href="libxml2-encoding.html#xmlCharEncError">xmlCharEncError</a> xmlCharEncConvFunc (void * vctxt, <br> unsigned char * out, <br> int * outlen, <br> const unsigned char * in, <br> int * inlen, <br> int flush)<br>
</pre>
<p>Convert between character encodings. The value of @inlen after return is the number of bytes consumed and @outlen is the number of bytes produced. If the converter can consume partial multi-byte sequences, the @flush flag can be used to detect truncated sequences at EOF. Otherwise, the flag can be ignored.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>vctxt</tt></i>:</span></td>
<td>conversion context</td>
</tr>
<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 input bytes</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>flush</tt></i>:</span></td>
<td>end of input</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>an XML_ENC_ERR code.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlCharEncConvImpl"></a>Function type xmlCharEncConvImpl</h3>
<pre class="programlisting"><a href="libxml2-xmlerror.html#xmlParserErrors">xmlParserErrors</a> xmlCharEncConvImpl (void * vctxt, <br> const char * name, <br> <a href="libxml2-encoding.html#xmlCharEncFlags">xmlCharEncFlags</a> flags, <br> <a href="libxml2-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a> ** out)<br>
</pre>
<p>If this function returns XML_ERR_OK, it must fill the @out pointer with an encoding handler. The handler can be obtained from <a href="libxml2-encoding.html#xmlCharEncNewCustomHandler">xmlCharEncNewCustomHandler</a>. @flags can contain XML_ENC_INPUT, <a href="libxml2-encoding.html#XML_ENC_OUTPUT">XML_ENC_OUTPUT</a> or both.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>vctxt</tt></i>:</span></td>
<td>user data</td>
</tr>
<tr>
<td><span class="term"><i><tt>name</tt></i>:</span></td>
<td>encoding name</td>
</tr>
<tr>
<td><span class="term"><i><tt>flags</tt></i>:</span></td>
<td>bit mask of flags</td>
</tr>
<tr>
<td><span class="term"><i><tt>out</tt></i>:</span></td>
<td>pointer to resulting handler</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>an <a href="libxml2-xmlerror.html#xmlParserErrors">xmlParserErrors</a> code.</td>
</tr>
</tbody>
</table></div>
</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>Convert characters to UTF-8. On success, the value of @inlen after return is the number of bytes consumed and @outlen is the number of bytes produced.</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 or an XML_ENC_ERR code.</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>Convert characters from UTF-8. On success, the value of @inlen after return is the number of bytes consumed and @outlen is the number of bytes produced.</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.</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>DEPRECATED: This function modifies global state and is not thread-safe. 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>Releases an <a href="libxml2-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a>. Must be called after a handler is no longer in 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>Returns</tt></i>:</span></td>
<td>0.</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="xmlCharEncNewCustomHandler"></a>xmlCharEncNewCustomHandler ()</h3>
<pre class="programlisting"><a href="libxml2-xmlerror.html#xmlParserErrors">xmlParserErrors</a> xmlCharEncNewCustomHandler (const char * name, <br> <a href="libxml2-encoding.html#xmlCharEncConvFunc">xmlCharEncConvFunc</a> input, <br> <a href="libxml2-encoding.html#xmlCharEncConvFunc">xmlCharEncConvFunc</a> output, <br> <a href="libxml2-encoding.html#xmlCharEncConvCtxtDtor">xmlCharEncConvCtxtDtor</a> ctxtDtor, <br> void * inputCtxt, <br> void * outputCtxt, <br> <a href="libxml2-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a> ** out)<br>
</pre>
<p>Create a custom <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</td>
</tr>
<tr>
<td><span class="term"><i><tt>input</tt></i>:</span></td>
<td>input callback which converts to UTF-8</td>
</tr>
<tr>
<td><span class="term"><i><tt>output</tt></i>:</span></td>
<td>output callback which converts from UTF-8</td>
</tr>
<tr>
<td><span class="term"><i><tt>ctxtDtor</tt></i>:</span></td>
<td>context destructor</td>
</tr>
<tr>
<td><span class="term"><i><tt>inputCtxt</tt></i>:</span></td>
<td>context for input callback</td>
</tr>
<tr>
<td><span class="term"><i><tt>outputCtxt</tt></i>:</span></td>
<td>context for output callback</td>
</tr>
<tr>
<td><span class="term"><i><tt>out</tt></i>:</span></td>
<td>pointer to resulting handler</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>an <a href="libxml2-xmlerror.html#xmlParserErrors">xmlParserErrors</a> 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>DEPRECATED: This function modifies global state and is not thread-safe. Unregisters all aliases</p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlCreateCharEncodingHandler"></a>xmlCreateCharEncodingHandler ()</h3>
<pre class="programlisting"><a href="libxml2-xmlerror.html#xmlParserErrors">xmlParserErrors</a> xmlCreateCharEncodingHandler (const char * name, <br> <a href="libxml2-encoding.html#xmlCharEncFlags">xmlCharEncFlags</a> flags, <br> <a href="libxml2-encoding.html#xmlCharEncConvImpl">xmlCharEncConvImpl</a> impl, <br> void * implCtxt, <br> <a href="libxml2-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a> ** out)<br>
</pre>
<p>Find or create a handler matching the encoding. The following converters are looked up in order: - Built-in handler (UTF-8, UTF-16, ISO-8859-1, ASCII) - Custom implementation if provided - User-registered global handler (deprecated) - iconv if enabled - ICU if enabled The handler must be closed with <a href="libxml2-encoding.html#xmlCharEncCloseFunc">xmlCharEncCloseFunc</a>. If the encoding is UTF-8, a NULL handler and no error code will be returned. @flags can contain XML_ENC_INPUT, <a href="libxml2-encoding.html#XML_ENC_OUTPUT">XML_ENC_OUTPUT</a> or both. Available since 2.14.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>flags</tt></i>:</span></td>
<td>bit mask of flags</td>
</tr>
<tr>
<td><span class="term"><i><tt>impl</tt></i>:</span></td>
<td>a conversion implementation (optional)</td>
</tr>
<tr>
<td><span class="term"><i><tt>implCtxt</tt></i>:</span></td>
<td>user data for conversion implementation (optional)</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>XML_ERR_OK, <a href="libxml2-xmlerror.html#XML_ERR_UNSUPPORTED_ENCODING">XML_ERR_UNSUPPORTED_ENCODING</a> or another <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="xmlDelEncodingAlias"></a>xmlDelEncodingAlias ()</h3>
<pre class="programlisting">int xmlDelEncodingAlias (const char * alias)<br>
</pre>
<p>DEPRECATED: This function modifies global state and is not thread-safe. 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. If the encoding is UTF-8, this will return a no-op handler that shouldn't be used.</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>DEPRECATED: This function is not thread-safe. 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="xmlIsolat1ToUTF8"></a>xmlIsolat1ToUTF8 ()</h3>
<pre class="programlisting">int xmlIsolat1ToUTF8 (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="xmlLookupCharEncodingHandler"></a>xmlLookupCharEncodingHandler ()</h3>
<pre class="programlisting"><a href="libxml2-xmlerror.html#xmlParserErrors">xmlParserErrors</a> 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. The following converters are looked up in order: - Built-in handler (UTF-8, UTF-16, ISO-8859-1, ASCII) - User-registered global handler (deprecated) - iconv if enabled - ICU if enabled The handler must be closed with <a href="libxml2-encoding.html#xmlCharEncCloseFunc">xmlCharEncCloseFunc</a>. If the encoding is UTF-8, a NULL handler and no error code will be returned. 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>XML_ERR_OK, <a href="libxml2-xmlerror.html#XML_ERR_UNSUPPORTED_ENCODING">XML_ERR_UNSUPPORTED_ENCODING</a> or another <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>DEPRECATED: This function modifies global state and is not thread-safe. 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"><a href="libxml2-xmlerror.html#xmlParserErrors">xmlParserErrors</a> 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. The following converters are looked up in order: - Built-in handler (UTF-8, UTF-16, ISO-8859-1, ASCII) - User-registered global handler (deprecated) - iconv if enabled - ICU if enabled The handler must be closed with <a href="libxml2-encoding.html#xmlCharEncCloseFunc">xmlCharEncCloseFunc</a>. If the encoding is UTF-8, a NULL handler and no error code will be returned. 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>XML_ERR_OK, <a href="libxml2-xmlerror.html#XML_ERR_UNSUPPORTED_ENCODING">XML_ERR_UNSUPPORTED_ENCODING</a> or another <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>DEPRECATED: This function modifies global state and is not thread-safe. Register the char encoding handler.</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 class="refsect2" lang="en">
<h3>
<a name="xmlUTF8ToIsolat1"></a>xmlUTF8ToIsolat1 ()</h3>
<pre class="programlisting">int xmlUTF8ToIsolat1 (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>
</div>
</body>
</html>