blob: 6ff158c189ba4a6c7ee9b13fd0b0561f536c423c [file] [log] [blame]
Daniel Veillardd4330462003-04-29 12:40:16 +00001<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>encoding</title><meta name="generator" content="DocBook XSL Stylesheets V1.58.1"><style xmlns="http://www.w3.org/TR/xhtml1/transitional" type="text/css">
2 .synopsis, .classsynopsis {
3 background: #eeeeee;
4 border: solid 1px #aaaaaa;
5 padding: 0.5em;
6 }
7 .programlisting {
8 background: #eeeeff;
9 border: solid 1px #aaaaff;
10 padding: 0.5em;
11 }
12 .variablelist {
13 padding: 4px;
14 margin-left: 3em;
15 }
16 .navigation {
17 background: #ffeeee;
18 border: solid 1px #ffaaaa;
19 margin-top: 0.5em;
20 margin-bottom: 0.5em;
21 }
22 .navigation a {
23 color: #770000;
24 }
25 .navigation a:visited {
26 color: #550000;
27 }
28 .navigation .title {
29 font-size: 200%;
30 }
31 </style><link rel="home" href="index.html" title="Gnome XML Library Reference Manual"><link rel="up" href="libxml-lib.html" title="Libxml Library Reference"><link rel="previous" href="libxml-parserInternals.html" title="parserInternals"><link rel="next" href="libxml-hash.html" title="hash"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="libxml-parserInternals.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></img></a></td><td><a accesskey="u" href="libxml-lib.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></img></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></img></a></td><th width="100%" align="center">Gnome XML Library Reference Manual</th><td><a accesskey="n" href="libxml-hash.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></img></a></td></tr></table><div class="refentry" lang="en"><a name="libxml-encoding"></a><div class="titlepage"></div><div class="refnamediv"><h2>encoding</h2><p>encoding &#8212; </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
Daniel Veillardaeea04f2000-01-25 19:27:27 +000032
Daniel Veillardd4330462003-04-29 12:40:16 +000033
34
35enum <a href="libxml-encoding.html#xmlCharEncoding">xmlCharEncoding</a>;
36int (<a href="libxml-encoding.html#xmlCharEncodingInputFunc">*xmlCharEncodingInputFunc</a>) (unsigned char *out,
Daniel Veillard3f6f7f62000-06-30 17:58:25 +000037 int *outlen,
Daniel Veillardaeea04f2000-01-25 19:27:27 +000038 unsigned char *in,
Daniel Veillardedfb29b2000-03-14 19:59:05 +000039 int *inlen);
Daniel Veillardd4330462003-04-29 12:40:16 +000040int (<a href="libxml-encoding.html#xmlCharEncodingOutputFunc">*xmlCharEncodingOutputFunc</a>) (unsigned char *out,
Daniel Veillard3f6f7f62000-06-30 17:58:25 +000041 int *outlen,
Daniel Veillardaeea04f2000-01-25 19:27:27 +000042 unsigned char *in,
Daniel Veillardedfb29b2000-03-14 19:59:05 +000043 int *inlen);
Daniel Veillardd4330462003-04-29 12:40:16 +000044struct <a href="libxml-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a>;
45typedef <a href="libxml-encoding.html#xmlCharEncodingHandlerPtr">xmlCharEncodingHandlerPtr</a>;
46void <a href="libxml-encoding.html#xmlInitCharEncodingHandlers">xmlInitCharEncodingHandlers</a> (void);
47void <a href="libxml-encoding.html#xmlCleanupCharEncodingHandlers">xmlCleanupCharEncodingHandlers</a> (void);
48void <a href="libxml-encoding.html#xmlRegisterCharEncodingHandler">xmlRegisterCharEncodingHandler</a> (<a href="libxml-encoding.html#xmlCharEncodingHandlerPtr">xmlCharEncodingHandlerPtr</a> handler);
49<a href="libxml-encoding.html#xmlCharEncodingHandlerPtr">xmlCharEncodingHandlerPtr</a> <a href="libxml-encoding.html#xmlGetCharEncodingHandler">xmlGetCharEncodingHandler</a>
50 (<a href="libxml-encoding.html#xmlCharEncoding">xmlCharEncoding</a> enc);
51<a href="libxml-encoding.html#xmlCharEncodingHandlerPtr">xmlCharEncodingHandlerPtr</a> <a href="libxml-encoding.html#xmlFindCharEncodingHandler">xmlFindCharEncodingHandler</a>
Daniel Veillardedfb29b2000-03-14 19:59:05 +000052 (const char *name);
Daniel Veillardd4330462003-04-29 12:40:16 +000053<a href="libxml-encoding.html#xmlCharEncodingHandlerPtr">xmlCharEncodingHandlerPtr</a> <a href="libxml-encoding.html#xmlNewCharEncodingHandler">xmlNewCharEncodingHandler</a>
Daniel Veillard2ace1952002-09-26 12:28:02 +000054 (const char *name,
Daniel Veillardd4330462003-04-29 12:40:16 +000055 <a href="libxml-encoding.html#xmlCharEncodingInputFunc">xmlCharEncodingInputFunc</a> input,
56 <a href="libxml-encoding.html#xmlCharEncodingOutputFunc">xmlCharEncodingOutputFunc</a> output);
57int <a href="libxml-encoding.html#xmlAddEncodingAlias">xmlAddEncodingAlias</a> (const char *name,
Daniel Veillard3bff2b02000-10-01 20:33:47 +000058 const char *alias);
Daniel Veillardd4330462003-04-29 12:40:16 +000059int <a href="libxml-encoding.html#xmlDelEncodingAlias">xmlDelEncodingAlias</a> (const char *alias);
60const char* <a href="libxml-encoding.html#xmlGetEncodingAlias">xmlGetEncodingAlias</a> (const char *alias);
61void <a href="libxml-encoding.html#xmlCleanupEncodingAliases">xmlCleanupEncodingAliases</a> (void);
62<a href="libxml-encoding.html#xmlCharEncoding">xmlCharEncoding</a> <a href="libxml-encoding.html#xmlParseCharEncoding">xmlParseCharEncoding</a> (const char *name);
63const char* <a href="libxml-encoding.html#xmlGetCharEncodingName">xmlGetCharEncodingName</a> (<a href="libxml-encoding.html#xmlCharEncoding">xmlCharEncoding</a> enc);
64<a href="libxml-encoding.html#xmlCharEncoding">xmlCharEncoding</a> <a href="libxml-encoding.html#xmlDetectCharEncoding">xmlDetectCharEncoding</a> (unsigned char *in,
Daniel Veillard3bff2b02000-10-01 20:33:47 +000065 int len);
Daniel Veillardd4330462003-04-29 12:40:16 +000066int <a href="libxml-encoding.html#xmlCharEncOutFunc">xmlCharEncOutFunc</a> (<a href="libxml-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a> *handler,
67 <a href="libxml-tree.html#xmlBufferPtr">xmlBufferPtr</a> out,
68 <a href="libxml-tree.html#xmlBufferPtr">xmlBufferPtr</a> in);
69int <a href="libxml-encoding.html#xmlCharEncInFunc">xmlCharEncInFunc</a> (<a href="libxml-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a> *handler,
70 <a href="libxml-tree.html#xmlBufferPtr">xmlBufferPtr</a> out,
71 <a href="libxml-tree.html#xmlBufferPtr">xmlBufferPtr</a> in);
72int <a href="libxml-encoding.html#xmlCharEncFirstLine">xmlCharEncFirstLine</a> (<a href="libxml-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a> *handler,
73 <a href="libxml-tree.html#xmlBufferPtr">xmlBufferPtr</a> out,
74 <a href="libxml-tree.html#xmlBufferPtr">xmlBufferPtr</a> in);
75int <a href="libxml-encoding.html#xmlCharEncCloseFunc">xmlCharEncCloseFunc</a> (<a href="libxml-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a> *handler);
76int <a href="libxml-encoding.html#UTF8Toisolat1">UTF8Toisolat1</a> (unsigned char *out,
Daniel Veillarda41123c2001-04-22 19:31:20 +000077 int *outlen,
78 unsigned char *in,
79 int *inlen);
Daniel Veillardd4330462003-04-29 12:40:16 +000080int <a href="libxml-encoding.html#isolat1ToUTF8">isolat1ToUTF8</a> (unsigned char *out,
Daniel Veillarda41123c2001-04-22 19:31:20 +000081 int *outlen,
82 unsigned char *in,
83 int *inlen);
Daniel Veillardd4330462003-04-29 12:40:16 +000084int <a href="libxml-encoding.html#xmlGetUTF8Char">xmlGetUTF8Char</a> (unsigned char *utf,
Daniel Veillardaec63562003-03-23 20:42:17 +000085 int *len);
Daniel Veillardd4330462003-04-29 12:40:16 +000086int <a href="libxml-encoding.html#xmlCheckUTF8">xmlCheckUTF8</a> (unsigned char *utf);
87int <a href="libxml-encoding.html#xmlUTF8Strsize">xmlUTF8Strsize</a> (const <a href="libxml-tree.html#xmlChar">xmlChar</a> *utf,
Daniel Veillard4ec885a2001-06-17 10:31:07 +000088 int len);
Daniel Veillardd4330462003-04-29 12:40:16 +000089<a href="libxml-tree.html#xmlChar">xmlChar</a>* <a href="libxml-encoding.html#xmlUTF8Strndup">xmlUTF8Strndup</a> (const <a href="libxml-tree.html#xmlChar">xmlChar</a> *utf,
Daniel Veillard4ec885a2001-06-17 10:31:07 +000090 int len);
Daniel Veillardd4330462003-04-29 12:40:16 +000091<a href="libxml-tree.html#xmlChar">xmlChar</a>* <a href="libxml-encoding.html#xmlUTF8Strpos">xmlUTF8Strpos</a> (const <a href="libxml-tree.html#xmlChar">xmlChar</a> *utf,
Daniel Veillard4ec885a2001-06-17 10:31:07 +000092 int pos);
Daniel Veillardd4330462003-04-29 12:40:16 +000093int <a href="libxml-encoding.html#xmlUTF8Strloc">xmlUTF8Strloc</a> (const <a href="libxml-tree.html#xmlChar">xmlChar</a> *utf,
94 const <a href="libxml-tree.html#xmlChar">xmlChar</a> *utfchar);
95<a href="libxml-tree.html#xmlChar">xmlChar</a>* <a href="libxml-encoding.html#xmlUTF8Strsub">xmlUTF8Strsub</a> (const <a href="libxml-tree.html#xmlChar">xmlChar</a> *utf,
Daniel Veillard4ec885a2001-06-17 10:31:07 +000096 int start,
97 int len);
Daniel Veillardd4330462003-04-29 12:40:16 +000098int <a href="libxml-encoding.html#xmlUTF8Strlen">xmlUTF8Strlen</a> (const <a href="libxml-tree.html#xmlChar">xmlChar</a> *utf);
99</pre></div><div class="refsect1" lang="en"><h2>Description</h2><p>
100
101</p></div><div class="refsect1" lang="en"><h2>Details</h2><div class="refsect2" lang="en"><h3><a name="xmlCharEncoding"></a>enum xmlCharEncoding</h3><pre class="programlisting">typedef enum {
Daniel Veillardaeea04f2000-01-25 19:27:27 +0000102 XML_CHAR_ENCODING_ERROR= -1, /* No char encoding detected */
103 XML_CHAR_ENCODING_NONE= 0, /* No char encoding detected */
104 XML_CHAR_ENCODING_UTF8= 1, /* UTF-8 */
105 XML_CHAR_ENCODING_UTF16LE= 2, /* UTF-16 little endian */
106 XML_CHAR_ENCODING_UTF16BE= 3, /* UTF-16 big endian */
107 XML_CHAR_ENCODING_UCS4LE= 4, /* UCS-4 little endian */
108 XML_CHAR_ENCODING_UCS4BE= 5, /* UCS-4 big endian */
109 XML_CHAR_ENCODING_EBCDIC= 6, /* EBCDIC uh! */
110 XML_CHAR_ENCODING_UCS4_2143=7, /* UCS-4 unusual ordering */
111 XML_CHAR_ENCODING_UCS4_3412=8, /* UCS-4 unusual ordering */
112 XML_CHAR_ENCODING_UCS2= 9, /* UCS-2 */
113 XML_CHAR_ENCODING_8859_1= 10,/* ISO-8859-1 ISO Latin 1 */
114 XML_CHAR_ENCODING_8859_2= 11,/* ISO-8859-2 ISO Latin 2 */
115 XML_CHAR_ENCODING_8859_3= 12,/* ISO-8859-3 */
116 XML_CHAR_ENCODING_8859_4= 13,/* ISO-8859-4 */
117 XML_CHAR_ENCODING_8859_5= 14,/* ISO-8859-5 */
118 XML_CHAR_ENCODING_8859_6= 15,/* ISO-8859-6 */
119 XML_CHAR_ENCODING_8859_7= 16,/* ISO-8859-7 */
120 XML_CHAR_ENCODING_8859_8= 17,/* ISO-8859-8 */
121 XML_CHAR_ENCODING_8859_9= 18,/* ISO-8859-9 */
122 XML_CHAR_ENCODING_2022_JP= 19,/* ISO-2022-JP */
123 XML_CHAR_ENCODING_SHIFT_JIS=20,/* Shift_JIS */
Daniel Veillarde46e20d2000-07-14 15:02:46 +0000124 XML_CHAR_ENCODING_EUC_JP= 21,/* EUC-JP */
125 XML_CHAR_ENCODING_ASCII= 22 /* pure ASCII */
Daniel Veillardd4330462003-04-29 12:40:16 +0000126} xmlCharEncoding;
127</pre><p>
128Predefined values for some standard encodings.
Daniel Veillard19274092002-03-25 16:48:03 +0000129Libxml don't do beforehand translation on UTF8, ISOLatinX.
Daniel Veillardd4330462003-04-29 12:40:16 +0000130It also support UTF16 (LE and BE) by default.
131</p><p>
132Anything else would have to be translated to UTF8 before being
Daniel Veillarde7ead2d2001-08-22 23:44:09 +0000133given to the parser itself. The BOM for UTF16 and the encoding
134declaration are looked at and a converter is looked for at that
135point. If not found the parser stops here as asked by the XML REC
136Converter can be registered by the user using xmlRegisterCharEncodingHandler
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000137but the current form doesn't allow stateful transcoding (a serious
Daniel Veillarde7ead2d2001-08-22 23:44:09 +0000138problem agreed !). If iconv has been found it will be used
139automatically and allow stateful transcoding, the simplest is then
140to be sure to enable icon and to provide iconv libs for the encoding
Daniel Veillardd4330462003-04-29 12:40:16 +0000141support needed.</p><p>
142
143</p></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlCharEncodingInputFunc"></a>xmlCharEncodingInputFunc ()</h3><pre class="programlisting">int (*xmlCharEncodingInputFunc) (unsigned char *out,
Daniel Veillard3f6f7f62000-06-30 17:58:25 +0000144 int *outlen,
Daniel Veillardaeea04f2000-01-25 19:27:27 +0000145 unsigned char *in,
Daniel Veillardd4330462003-04-29 12:40:16 +0000146 int *inlen);</pre><p>
147Take a block of chars in the original encoding and try to convert
148it to an UTF-8 block of chars out.</p><p>
149
Daniel Veillardd7cec922003-06-13 12:30:10 +0000150</p><div class="variablelist"><table border="0"><col align="left" valign="top"><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
151</td></tr><tr><td><span class="term"><i><tt>outlen</tt></i> :</span></td><td> the length of <i><tt>out</tt></i>
152</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
153</td></tr><tr><td><span class="term"><i><tt>inlen</tt></i> :</span></td><td> the length of <i><tt>in</tt></i>
154</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the number of byte written, or -1 by lack of space, or -2
155 if the transcoding failed.
156The value of <i><tt>inlen</tt></i> after return is the number of octets consumed
157 as the return value is positive, else unpredictiable.
158The value of <i><tt>outlen</tt></i> after return is the number of octets consumed.
Daniel Veillardd4330462003-04-29 12:40:16 +0000159</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlCharEncodingOutputFunc"></a>xmlCharEncodingOutputFunc ()</h3><pre class="programlisting">int (*xmlCharEncodingOutputFunc) (unsigned char *out,
Daniel Veillard3f6f7f62000-06-30 17:58:25 +0000160 int *outlen,
Daniel Veillardaeea04f2000-01-25 19:27:27 +0000161 unsigned char *in,
Daniel Veillardd4330462003-04-29 12:40:16 +0000162 int *inlen);</pre><p>
163Take a block of UTF-8 chars in and try to convert it to an other
Daniel Veillarde7ead2d2001-08-22 23:44:09 +0000164encoding.
165Note: a first call designed to produce heading info is called with
Daniel Veillardd4330462003-04-29 12:40:16 +0000166in = NULL. If stateful this should also initialize the encoder state.</p><p>
167
Daniel Veillardd7cec922003-06-13 12:30:10 +0000168</p><div class="variablelist"><table border="0"><col align="left" valign="top"><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
169</td></tr><tr><td><span class="term"><i><tt>outlen</tt></i> :</span></td><td> the length of <i><tt>out</tt></i>
170</td></tr><tr><td><span class="term"><i><tt>in</tt></i> :</span></td><td> a pointer to an array of UTF-8 chars
171</td></tr><tr><td><span class="term"><i><tt>inlen</tt></i> :</span></td><td> the length of <i><tt>in</tt></i>
172</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the number of byte written, or -1 by lack of space, or -2
173 if the transcoding failed.
174The value of <i><tt>inlen</tt></i> after return is the number of octets consumed
175 as the return value is positive, else unpredictiable.
176The value of <i><tt>outlen</tt></i> after return is the number of ocetes consumed.
Daniel Veillardd4330462003-04-29 12:40:16 +0000177</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlCharEncodingHandler"></a>struct xmlCharEncodingHandler</h3><pre class="programlisting">struct xmlCharEncodingHandler {
Daniel Veillard3f6f7f62000-06-30 17:58:25 +0000178 char *name;
179 xmlCharEncodingInputFunc input;
180 xmlCharEncodingOutputFunc output;
181#ifdef LIBXML_ICONV_ENABLED
182 iconv_t iconv_in;
183 iconv_t iconv_out;
184#endif /* LIBXML_ICONV_ENABLED */
Daniel Veillardd4330462003-04-29 12:40:16 +0000185};
186</pre><p>
187
Daniel Veillardd7cec922003-06-13 12:30:10 +0000188</p></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlCharEncodingHandlerPtr"></a>xmlCharEncodingHandlerPtr</h3><pre class="programlisting">typedef xmlCharEncodingHandler *xmlCharEncodingHandlerPtr;
189</pre><p>
Daniel Veillardd4330462003-04-29 12:40:16 +0000190
191</p></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlInitCharEncodingHandlers"></a>xmlInitCharEncodingHandlers ()</h3><pre class="programlisting">void xmlInitCharEncodingHandlers (void);</pre><p>
192Initialize the char encoding support, it registers the default
Daniel Veillard3f6f7f62000-06-30 17:58:25 +0000193encoding supported.
194NOTE: while public, this function usually doesn't need to be called
Daniel Veillardd4330462003-04-29 12:40:16 +0000195 in normal processing.</p><p>
196
197</p></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlCleanupCharEncodingHandlers"></a>xmlCleanupCharEncodingHandlers ()</h3><pre class="programlisting">void xmlCleanupCharEncodingHandlers (void);</pre><p>
198Cleanup the memory allocated for the char encoding support, it
199unregisters all the encoding handlers and the aliases.</p><p>
200
201</p></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlRegisterCharEncodingHandler"></a>xmlRegisterCharEncodingHandler ()</h3><pre class="programlisting">void xmlRegisterCharEncodingHandler (<a href="libxml-encoding.html#xmlCharEncodingHandlerPtr">xmlCharEncodingHandlerPtr</a> handler);</pre><p>
202Register the char encoding handler, surprising, isn't it ?</p><p>
203
Daniel Veillardd7cec922003-06-13 12:30:10 +0000204</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>handler</tt></i> :</span></td><td> the xmlCharEncodingHandlerPtr handler block
Daniel Veillardd4330462003-04-29 12:40:16 +0000205</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlGetCharEncodingHandler"></a>xmlGetCharEncodingHandler ()</h3><pre class="programlisting"><a href="libxml-encoding.html#xmlCharEncodingHandlerPtr">xmlCharEncodingHandlerPtr</a> xmlGetCharEncodingHandler
206 (<a href="libxml-encoding.html#xmlCharEncoding">xmlCharEncoding</a> enc);</pre><p>
207Search in the registered set the handler able to read/write that encoding.</p><p>
208
Daniel Veillardd7cec922003-06-13 12:30:10 +0000209</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>enc</tt></i> :</span></td><td> an xmlCharEncoding value.
210</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the handler or NULL if not found
Daniel Veillardd4330462003-04-29 12:40:16 +0000211</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlFindCharEncodingHandler"></a>xmlFindCharEncodingHandler ()</h3><pre class="programlisting"><a href="libxml-encoding.html#xmlCharEncodingHandlerPtr">xmlCharEncodingHandlerPtr</a> xmlFindCharEncodingHandler
212 (const char *name);</pre><p>
213Search in the registered set the handler able to read/write that encoding.</p><p>
214
Daniel Veillardd7cec922003-06-13 12:30:10 +0000215</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>name</tt></i> :</span></td><td> a string describing the char encoding.
216</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the handler or NULL if not found
Daniel Veillardd4330462003-04-29 12:40:16 +0000217</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlNewCharEncodingHandler"></a>xmlNewCharEncodingHandler ()</h3><pre class="programlisting"><a href="libxml-encoding.html#xmlCharEncodingHandlerPtr">xmlCharEncodingHandlerPtr</a> xmlNewCharEncodingHandler
Daniel Veillard2ace1952002-09-26 12:28:02 +0000218 (const char *name,
Daniel Veillardd4330462003-04-29 12:40:16 +0000219 <a href="libxml-encoding.html#xmlCharEncodingInputFunc">xmlCharEncodingInputFunc</a> input,
220 <a href="libxml-encoding.html#xmlCharEncodingOutputFunc">xmlCharEncodingOutputFunc</a> output);</pre><p>
221Create and registers an xmlCharEncodingHandler.</p><p>
222
Daniel Veillardd7cec922003-06-13 12:30:10 +0000223</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>name</tt></i> :</span></td><td> the encoding name, in UTF-8 format (ASCII actually)
224</td></tr><tr><td><span class="term"><i><tt>input</tt></i> :</span></td><td> the xmlCharEncodingInputFunc to read that encoding
225</td></tr><tr><td><span class="term"><i><tt>output</tt></i> :</span></td><td> the xmlCharEncodingOutputFunc to write that encoding
226</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the xmlCharEncodingHandlerPtr created (or NULL in case of error).
Daniel Veillardd4330462003-04-29 12:40:16 +0000227</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlAddEncodingAlias"></a>xmlAddEncodingAlias ()</h3><pre class="programlisting">int xmlAddEncodingAlias (const char *name,
228 const char *alias);</pre><p>
229Registers and alias <i><tt>alias</tt></i> for an encoding named <i><tt>name</tt></i>. Existing alias
230will be overwritten.</p><p>
231
Daniel Veillardd7cec922003-06-13 12:30:10 +0000232</p><div class="variablelist"><table border="0"><col align="left" valign="top"><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)
233</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)
234</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>0 in case of success, -1 in case of error
Daniel Veillardd4330462003-04-29 12:40:16 +0000235</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlDelEncodingAlias"></a>xmlDelEncodingAlias ()</h3><pre class="programlisting">int xmlDelEncodingAlias (const char *alias);</pre><p>
236Unregisters an encoding alias <i><tt>alias</tt></i></p><p>
237
Daniel Veillardd7cec922003-06-13 12:30:10 +0000238</p><div class="variablelist"><table border="0"><col align="left" valign="top"><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)
239</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>0 in case of success, -1 in case of error
Daniel Veillardd4330462003-04-29 12:40:16 +0000240</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlGetEncodingAlias"></a>xmlGetEncodingAlias ()</h3><pre class="programlisting">const char* xmlGetEncodingAlias (const char *alias);</pre><p>
241Lookup an encoding name for the given alias.</p><p>
242
Daniel Veillardd7cec922003-06-13 12:30:10 +0000243</p><div class="variablelist"><table border="0"><col align="left" valign="top"><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)
244</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>NULL if not found the original name otherwise
Daniel Veillardd4330462003-04-29 12:40:16 +0000245</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlCleanupEncodingAliases"></a>xmlCleanupEncodingAliases ()</h3><pre class="programlisting">void xmlCleanupEncodingAliases (void);</pre><p>
246Unregisters all aliases</p><p>
247
248</p></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlParseCharEncoding"></a>xmlParseCharEncoding ()</h3><pre class="programlisting"><a href="libxml-encoding.html#xmlCharEncoding">xmlCharEncoding</a> xmlParseCharEncoding (const char *name);</pre><p>
249Compare the string to the known encoding schemes already known. Note
Daniel Veillard3bff2b02000-10-01 20:33:47 +0000250that the comparison is case insensitive accordingly to the section
Daniel Veillardd4330462003-04-29 12:40:16 +0000251[XML] 4.3.3 Character Encoding in Entities.</p><p>
252
Daniel Veillardd7cec922003-06-13 12:30:10 +0000253</p><div class="variablelist"><table border="0"><col align="left" valign="top"><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)
254</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>one of the XML_CHAR_ENCODING_... values or XML_CHAR_ENCODING_NONE
255if not recognized.
Daniel Veillardd4330462003-04-29 12:40:16 +0000256</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlGetCharEncodingName"></a>xmlGetCharEncodingName ()</h3><pre class="programlisting">const char* xmlGetCharEncodingName (<a href="libxml-encoding.html#xmlCharEncoding">xmlCharEncoding</a> enc);</pre><p>
257The &quot;canonical&quot; name for XML encoding.
258C.f. http://www.w3.org/TR/REC-xml<GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="charencoding">charencoding</GTKDOCLINK>
259Section 4.3.3 Character Encoding in Entities</p><p>
260
Daniel Veillardd7cec922003-06-13 12:30:10 +0000261</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>enc</tt></i> :</span></td><td> the encoding
262</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the canonical name for the given encoding
Daniel Veillardd4330462003-04-29 12:40:16 +0000263</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlDetectCharEncoding"></a>xmlDetectCharEncoding ()</h3><pre class="programlisting"><a href="libxml-encoding.html#xmlCharEncoding">xmlCharEncoding</a> xmlDetectCharEncoding (unsigned char *in,
264 int len);</pre><p>
265Guess the encoding of the entity using the first bytes of the entity content
266accordingly of the non-normative appendix F of the XML-1.0 recommendation.</p><p>
267
Daniel Veillardd7cec922003-06-13 12:30:10 +0000268</p><div class="variablelist"><table border="0"><col align="left" valign="top"><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
269 4 bytes long.
270</td></tr><tr><td><span class="term"><i><tt>len</tt></i> :</span></td><td> pointer to the length of the buffer
271</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>one of the XML_CHAR_ENCODING_... values.
Daniel Veillardd4330462003-04-29 12:40:16 +0000272</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlCharEncOutFunc"></a>xmlCharEncOutFunc ()</h3><pre class="programlisting">int xmlCharEncOutFunc (<a href="libxml-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a> *handler,
273 <a href="libxml-tree.html#xmlBufferPtr">xmlBufferPtr</a> out,
274 <a href="libxml-tree.html#xmlBufferPtr">xmlBufferPtr</a> in);</pre><p>
275Generic front-end for the encoding handler output function
276a first call with <i><tt>in</tt></i> == NULL has to be made firs to initiate the
Daniel Veillard3f6f7f62000-06-30 17:58:25 +0000277output in case of non-stateless encoding needing to initiate their
278state or the output (like the BOM in UTF16).
279In case of UTF8 sequence conversion errors for the given encoder,
Daniel Veillardd4330462003-04-29 12:40:16 +0000280the content will be automatically remapped to a CharRef sequence.</p><p>
281
Daniel Veillardd7cec922003-06-13 12:30:10 +0000282</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>handler</tt></i> :</span></td><td> char enconding transformation data structure
283</td></tr><tr><td><span class="term"><i><tt>out</tt></i> :</span></td><td> an xmlBuffer for the output.
284</td></tr><tr><td><span class="term"><i><tt>in</tt></i> :</span></td><td> an xmlBuffer for the input
285</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the number of byte written if success, or
286 -1 general error
287 -2 if the transcoding fails (for *in is not valid utf8 string or
288 the result of transformation can't fit into the encoding we want), or
Daniel Veillardd4330462003-04-29 12:40:16 +0000289</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlCharEncInFunc"></a>xmlCharEncInFunc ()</h3><pre class="programlisting">int xmlCharEncInFunc (<a href="libxml-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a> *handler,
290 <a href="libxml-tree.html#xmlBufferPtr">xmlBufferPtr</a> out,
291 <a href="libxml-tree.html#xmlBufferPtr">xmlBufferPtr</a> in);</pre><p>
292Generic front-end for the encoding handler input function</p><p>
293
Daniel Veillardd7cec922003-06-13 12:30:10 +0000294</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>handler</tt></i> :</span></td><td> char encoding transformation data structure
295</td></tr><tr><td><span class="term"><i><tt>out</tt></i> :</span></td><td> an xmlBuffer for the output.
296</td></tr><tr><td><span class="term"><i><tt>in</tt></i> :</span></td><td> an xmlBuffer for the input
297</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the number of byte written if success, or
298 -1 general error
299 -2 if the transcoding fails (for *in is not valid utf8 string or
300 the result of transformation can't fit into the encoding we want), or
Daniel Veillardd4330462003-04-29 12:40:16 +0000301</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlCharEncFirstLine"></a>xmlCharEncFirstLine ()</h3><pre class="programlisting">int xmlCharEncFirstLine (<a href="libxml-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a> *handler,
302 <a href="libxml-tree.html#xmlBufferPtr">xmlBufferPtr</a> out,
303 <a href="libxml-tree.html#xmlBufferPtr">xmlBufferPtr</a> in);</pre><p>
304Front-end for the encoding handler input function, but handle only
305the very first line, i.e. limit itself to 45 chars.</p><p>
306
Daniel Veillardd7cec922003-06-13 12:30:10 +0000307</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>handler</tt></i> :</span></td><td> char enconding transformation data structure
308</td></tr><tr><td><span class="term"><i><tt>out</tt></i> :</span></td><td> an xmlBuffer for the output.
309</td></tr><tr><td><span class="term"><i><tt>in</tt></i> :</span></td><td> an xmlBuffer for the input
310</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the number of byte written if success, or
311 -1 general error
312 -2 if the transcoding fails (for *in is not valid utf8 string or
313 the result of transformation can't fit into the encoding we want), or
Daniel Veillardd4330462003-04-29 12:40:16 +0000314</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlCharEncCloseFunc"></a>xmlCharEncCloseFunc ()</h3><pre class="programlisting">int xmlCharEncCloseFunc (<a href="libxml-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a> *handler);</pre><p>
315Generic front-end for encoding handler close function</p><p>
316
Daniel Veillardd7cec922003-06-13 12:30:10 +0000317</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>handler</tt></i> :</span></td><td> char enconding transformation data structure
318</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>0 if success, or -1 in case of error
Daniel Veillardd4330462003-04-29 12:40:16 +0000319</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="UTF8Toisolat1"></a>UTF8Toisolat1 ()</h3><pre class="programlisting">int UTF8Toisolat1 (unsigned char *out,
Daniel Veillarda41123c2001-04-22 19:31:20 +0000320 int *outlen,
321 unsigned char *in,
Daniel Veillardd4330462003-04-29 12:40:16 +0000322 int *inlen);</pre><p>
323Take a block of UTF-8 chars in and try to convert it to an ISO Latin 1
324block of chars out.</p><p>
325
Daniel Veillardd7cec922003-06-13 12:30:10 +0000326</p><div class="variablelist"><table border="0"><col align="left" valign="top"><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
327</td></tr><tr><td><span class="term"><i><tt>outlen</tt></i> :</span></td><td> the length of <i><tt>out</tt></i>
328</td></tr><tr><td><span class="term"><i><tt>in</tt></i> :</span></td><td> a pointer to an array of UTF-8 chars
329</td></tr><tr><td><span class="term"><i><tt>inlen</tt></i> :</span></td><td> the length of <i><tt>in</tt></i>
330</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>0 if success, -2 if the transcoding fails, or -1 otherwise
331The value of <i><tt>inlen</tt></i> after return is the number of octets consumed
332 as the return value is positive, else unpredictable.
333The value of <i><tt>outlen</tt></i> after return is the number of ocetes consumed.
Daniel Veillardd4330462003-04-29 12:40:16 +0000334</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="isolat1ToUTF8"></a>isolat1ToUTF8 ()</h3><pre class="programlisting">int isolat1ToUTF8 (unsigned char *out,
Daniel Veillarda41123c2001-04-22 19:31:20 +0000335 int *outlen,
336 unsigned char *in,
Daniel Veillardd4330462003-04-29 12:40:16 +0000337 int *inlen);</pre><p>
338Take a block of ISO Latin 1 chars in and try to convert it to an UTF-8
339block of chars out.</p><p>
340
Daniel Veillardd7cec922003-06-13 12:30:10 +0000341</p><div class="variablelist"><table border="0"><col align="left" valign="top"><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
342</td></tr><tr><td><span class="term"><i><tt>outlen</tt></i> :</span></td><td> the length of <i><tt>out</tt></i>
343</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
344</td></tr><tr><td><span class="term"><i><tt>inlen</tt></i> :</span></td><td> the length of <i><tt>in</tt></i>
345</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>0 if success, or -1 otherwise
346The value of <i><tt>inlen</tt></i> after return is the number of octets consumed
347 as the return value is positive, else unpredictable.
348The value of <i><tt>outlen</tt></i> after return is the number of ocetes consumed.
Daniel Veillardd4330462003-04-29 12:40:16 +0000349</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlGetUTF8Char"></a>xmlGetUTF8Char ()</h3><pre class="programlisting">int xmlGetUTF8Char (unsigned char *utf,
350 int *len);</pre><p>
351Read one UTF8 Char from <i><tt>utf</tt></i></p><p>
352
Daniel Veillardd7cec922003-06-13 12:30:10 +0000353</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>utf</tt></i> :</span></td><td> a sequence of UTF-8 encoded bytes
354</td></tr><tr><td><span class="term"><i><tt>len</tt></i> :</span></td><td> a pointer to <i><tt>bytes</tt></i> len
355</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the char value or -1 in case of error and update <i><tt>len</tt></i> with the
356 number of bytes used
Daniel Veillardd4330462003-04-29 12:40:16 +0000357</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlCheckUTF8"></a>xmlCheckUTF8 ()</h3><pre class="programlisting">int xmlCheckUTF8 (unsigned char *utf);</pre><p>
358Checks <i><tt>utf</tt></i> for being valid utf-8. <i><tt>utf</tt></i> is assumed to be
Daniel Veillarda41123c2001-04-22 19:31:20 +0000359null-terminated. This function is not super-strict, as it will
360allow longer utf-8 sequences than necessary. Note that Java is
361capable of producing these sequences if provoked. Also note, this
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000362routine checks for the 4-byte maximum size, but does not check for
Daniel Veillardd4330462003-04-29 12:40:16 +00003630x10ffff maximum value.</p><p>
364
Daniel Veillardd7cec922003-06-13 12:30:10 +0000365</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>utf</tt></i> :</span></td><td> Pointer to putative utf-8 encoded string.
366</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> true if <i><tt>utf</tt></i> is valid.
Daniel Veillardd4330462003-04-29 12:40:16 +0000367</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlUTF8Strsize"></a>xmlUTF8Strsize ()</h3><pre class="programlisting">int xmlUTF8Strsize (const <a href="libxml-tree.html#xmlChar">xmlChar</a> *utf,
368 int len);</pre><p>
369storage size of an UTF8 string</p><p>
370
Daniel Veillardd7cec922003-06-13 12:30:10 +0000371</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>utf</tt></i> :</span></td><td> a sequence of UTF-8 encoded bytes
372</td></tr><tr><td><span class="term"><i><tt>len</tt></i> :</span></td><td> the number of characters in the array
373</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the storage size of
374the first 'len' characters of ARRAY
Daniel Veillardd4330462003-04-29 12:40:16 +0000375
376</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlUTF8Strndup"></a>xmlUTF8Strndup ()</h3><pre class="programlisting"><a href="libxml-tree.html#xmlChar">xmlChar</a>* xmlUTF8Strndup (const <a href="libxml-tree.html#xmlChar">xmlChar</a> *utf,
377 int len);</pre><p>
378a strndup for array of UTF8's</p><p>
379
Daniel Veillardd7cec922003-06-13 12:30:10 +0000380</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>utf</tt></i> :</span></td><td> the input UTF8 *
381</td></tr><tr><td><span class="term"><i><tt>len</tt></i> :</span></td><td> the len of <i><tt>utf</tt></i> (in chars)
382</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>a new UTF8 * or NULL
Daniel Veillardd4330462003-04-29 12:40:16 +0000383</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlUTF8Strpos"></a>xmlUTF8Strpos ()</h3><pre class="programlisting"><a href="libxml-tree.html#xmlChar">xmlChar</a>* xmlUTF8Strpos (const <a href="libxml-tree.html#xmlChar">xmlChar</a> *utf,
384 int pos);</pre><p>
385a function to provide the equivalent of fetching a
386character from a string array</p><p>
387
Daniel Veillardd7cec922003-06-13 12:30:10 +0000388</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>utf</tt></i> :</span></td><td> the input UTF8 *
389</td></tr><tr><td><span class="term"><i><tt>pos</tt></i> :</span></td><td> the position of the desired UTF8 char (in chars)
390</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>a pointer to the UTF8 character or NULL
Daniel Veillardd4330462003-04-29 12:40:16 +0000391</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlUTF8Strloc"></a>xmlUTF8Strloc ()</h3><pre class="programlisting">int xmlUTF8Strloc (const <a href="libxml-tree.html#xmlChar">xmlChar</a> *utf,
392 const <a href="libxml-tree.html#xmlChar">xmlChar</a> *utfchar);</pre><p>
393a function to provide relative location of a UTF8 char</p><p>
394
Daniel Veillardd7cec922003-06-13 12:30:10 +0000395</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>utf</tt></i> :</span></td><td> the input UTF8 *
396</td></tr><tr><td><span class="term"><i><tt>utfchar</tt></i> :</span></td><td> the UTF8 character to be found
397</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the relative character position of the desired char
398or -1 if not found
Daniel Veillardd4330462003-04-29 12:40:16 +0000399</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlUTF8Strsub"></a>xmlUTF8Strsub ()</h3><pre class="programlisting"><a href="libxml-tree.html#xmlChar">xmlChar</a>* xmlUTF8Strsub (const <a href="libxml-tree.html#xmlChar">xmlChar</a> *utf,
Daniel Veillard4ec885a2001-06-17 10:31:07 +0000400 int start,
Daniel Veillardd4330462003-04-29 12:40:16 +0000401 int len);</pre><p>
402Note: positions are given in units of UTF-8 chars</p><p>
403
Daniel Veillardd7cec922003-06-13 12:30:10 +0000404</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>utf</tt></i> :</span></td><td> a sequence of UTF-8 encoded bytes
405</td></tr><tr><td><span class="term"><i><tt>start</tt></i> :</span></td><td> relative pos of first char
406</td></tr><tr><td><span class="term"><i><tt>len</tt></i> :</span></td><td> total number to copy
407</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>a pointer to a newly created string
408or NULL if any problem
Daniel Veillardd4330462003-04-29 12:40:16 +0000409</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlUTF8Strlen"></a>xmlUTF8Strlen ()</h3><pre class="programlisting">int xmlUTF8Strlen (const <a href="libxml-tree.html#xmlChar">xmlChar</a> *utf);</pre><p>
410compute the length of an UTF8 string, it doesn't do a full UTF8
411checking of the content of the string.</p><p>
412
Daniel Veillardd7cec922003-06-13 12:30:10 +0000413</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>utf</tt></i> :</span></td><td> a sequence of UTF-8 encoded bytes
414</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the number of characters in the string or -1 in case of error
Daniel Veillardd4330462003-04-29 12:40:16 +0000415</td></tr></tbody></table></div></div></div></div><table xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="libxml-parserInternals.html"><b>&lt;&lt; parserInternals</b></a></td><td align="right"><a accesskey="n" href="libxml-hash.html"><b>hash &gt;&gt;</b></a></td></tr></table></body></html>