ReactOS 0.4.15-dev-8135-g1bc6c90
encoding.h
Go to the documentation of this file.
1/*
2 * Summary: interface for the encoding conversion functions
3 * Description: interface for the encoding conversion functions needed for
4 * XML basic encoding and iconv() support.
5 *
6 * Related specs are
7 * rfc2044 (UTF-8 and UTF-16) F. Yergeau Alis Technologies
8 * [ISO-10646] UTF-8 and UTF-16 in Annexes
9 * [ISO-8859-1] ISO Latin-1 characters codes.
10 * [UNICODE] The Unicode Consortium, "The Unicode Standard --
11 * Worldwide Character Encoding -- Version 1.0", Addison-
12 * Wesley, Volume 1, 1991, Volume 2, 1992. UTF-8 is
13 * described in Unicode Technical Report #4.
14 * [US-ASCII] Coded Character Set--7-bit American Standard Code for
15 * Information Interchange, ANSI X3.4-1986.
16 *
17 * Copy: See Copyright for the status of this software.
18 *
19 * Author: Daniel Veillard
20 */
21
22#ifndef __XML_CHAR_ENCODING_H__
23#define __XML_CHAR_ENCODING_H__
24
25#include <libxml/xmlversion.h>
26
27#ifdef LIBXML_ICONV_ENABLED
28#include <iconv.h>
29#endif
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35/*
36 * xmlCharEncoding:
37 *
38 * Predefined values for some standard encodings.
39 * Libxml does not do beforehand translation on UTF8 and ISOLatinX.
40 * It also supports ASCII, ISO-8859-1, and UTF16 (LE and BE) by default.
41 *
42 * Anything else would have to be translated to UTF8 before being
43 * given to the parser itself. The BOM for UTF16 and the encoding
44 * declaration are looked at and a converter is looked for at that
45 * point. If not found the parser stops here as asked by the XML REC. A
46 * converter can be registered by the user using xmlRegisterCharEncodingHandler
47 * but the current form doesn't allow stateful transcoding (a serious
48 * problem agreed !). If iconv has been found it will be used
49 * automatically and allow stateful transcoding, the simplest is then
50 * to be sure to enable iconv and to provide iconv libs for the encoding
51 * support needed.
52 *
53 * Note that the generic "UTF-16" is not a predefined value. Instead, only
54 * the specific UTF-16LE and UTF-16BE are present.
55 */
56typedef enum {
57 XML_CHAR_ENCODING_ERROR= -1, /* No char encoding detected */
58 XML_CHAR_ENCODING_NONE= 0, /* No char encoding detected */
59 XML_CHAR_ENCODING_UTF8= 1, /* UTF-8 */
60 XML_CHAR_ENCODING_UTF16LE= 2, /* UTF-16 little endian */
61 XML_CHAR_ENCODING_UTF16BE= 3, /* UTF-16 big endian */
62 XML_CHAR_ENCODING_UCS4LE= 4, /* UCS-4 little endian */
63 XML_CHAR_ENCODING_UCS4BE= 5, /* UCS-4 big endian */
64 XML_CHAR_ENCODING_EBCDIC= 6, /* EBCDIC uh! */
65 XML_CHAR_ENCODING_UCS4_2143=7, /* UCS-4 unusual ordering */
66 XML_CHAR_ENCODING_UCS4_3412=8, /* UCS-4 unusual ordering */
67 XML_CHAR_ENCODING_UCS2= 9, /* UCS-2 */
68 XML_CHAR_ENCODING_8859_1= 10,/* ISO-8859-1 ISO Latin 1 */
69 XML_CHAR_ENCODING_8859_2= 11,/* ISO-8859-2 ISO Latin 2 */
70 XML_CHAR_ENCODING_8859_3= 12,/* ISO-8859-3 */
71 XML_CHAR_ENCODING_8859_4= 13,/* ISO-8859-4 */
72 XML_CHAR_ENCODING_8859_5= 14,/* ISO-8859-5 */
73 XML_CHAR_ENCODING_8859_6= 15,/* ISO-8859-6 */
74 XML_CHAR_ENCODING_8859_7= 16,/* ISO-8859-7 */
75 XML_CHAR_ENCODING_8859_8= 17,/* ISO-8859-8 */
76 XML_CHAR_ENCODING_8859_9= 18,/* ISO-8859-9 */
77 XML_CHAR_ENCODING_2022_JP= 19,/* ISO-2022-JP */
78 XML_CHAR_ENCODING_SHIFT_JIS=20,/* Shift_JIS */
79 XML_CHAR_ENCODING_EUC_JP= 21,/* EUC-JP */
80 XML_CHAR_ENCODING_ASCII= 22 /* pure ASCII */
82
99typedef int (* xmlCharEncodingInputFunc)(unsigned char *out, int *outlen,
100 const unsigned char *in, int *inlen);
101
102
121typedef int (* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen,
122 const unsigned char *in, int *inlen);
123
124
125/*
126 * Block defining the handlers for non UTF-8 encodings.
127 * If iconv is supported, there are two extra fields.
128 */
132 char *name;
135#ifdef LIBXML_ICONV_ENABLED
136 iconv_t iconv_in;
137 iconv_t iconv_out;
138#endif /* LIBXML_ICONV_ENABLED */
139#ifdef LIBXML_ICU_ENABLED
140 struct _uconv_t *uconv_in;
141 struct _uconv_t *uconv_out;
142#endif /* LIBXML_ICU_ENABLED */
143};
144
145#ifdef __cplusplus
146}
147#endif
148#include <libxml/tree.h>
149#ifdef __cplusplus
150extern "C" {
151#endif
152
153/*
154 * Interfaces for encoding handlers.
155 */
167 xmlFindCharEncodingHandler (const char *name);
169 xmlNewCharEncodingHandler (const char *name,
172
173/*
174 * Interfaces for encoding names and aliases.
175 */
177 xmlAddEncodingAlias (const char *name,
178 const char *alias);
180 xmlDelEncodingAlias (const char *alias);
181XMLPUBFUN const char * XMLCALL
182 xmlGetEncodingAlias (const char *alias);
186 xmlParseCharEncoding (const char *name);
187XMLPUBFUN const char * XMLCALL
189
190/*
191 * Interfaces directly used by the parsers.
192 */
194 xmlDetectCharEncoding (const unsigned char *in,
195 int len);
196
201
212
213/*
214 * Export a few useful functions
215 */
216#ifdef LIBXML_OUTPUT_ENABLED
218 UTF8Toisolat1 (unsigned char *out,
219 int *outlen,
220 const unsigned char *in,
221 int *inlen);
222#endif /* LIBXML_OUTPUT_ENABLED */
224 isolat1ToUTF8 (unsigned char *out,
225 int *outlen,
226 const unsigned char *in,
227 int *inlen);
228#ifdef __cplusplus
229}
230#endif
231
232#endif /* __XML_CHAR_ENCODING_H__ */
const WCHAR * alias
Definition: main.c:67
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7482
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
XMLPUBFUN int XMLCALL xmlCharEncCloseFunc(xmlCharEncodingHandler *handler)
Definition: encoding.c:2796
int(* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen, const unsigned char *in, int *inlen)
Definition: encoding.h:121
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL xmlNewCharEncodingHandler(const char *name, xmlCharEncodingInputFunc input, xmlCharEncodingOutputFunc output)
Definition: encoding.c:1338
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL xmlFindCharEncodingHandler(const char *name)
Definition: encoding.c:1678
XML_DEPRECATED XMLPUBFUN void XMLCALL xmlInitCharEncodingHandlers(void)
Definition: encoding.c:1420
XMLPUBFUN void XMLCALL xmlCleanupEncodingAliases(void)
Definition: encoding.c:1012
XMLPUBFUN void XMLCALL xmlRegisterCharEncodingHandler(xmlCharEncodingHandlerPtr handler)
Definition: encoding.c:1509
XMLPUBFUN int XMLCALL xmlCharEncFirstLine(xmlCharEncodingHandler *handler, xmlBufferPtr out, xmlBufferPtr in)
Definition: encoding.c:2160
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL xmlGetCharEncodingHandler(xmlCharEncoding enc)
Definition: encoding.c:1544
xmlCharEncoding
Definition: encoding.h:56
@ XML_CHAR_ENCODING_8859_6
Definition: encoding.h:73
@ XML_CHAR_ENCODING_UTF8
Definition: encoding.h:59
@ XML_CHAR_ENCODING_8859_7
Definition: encoding.h:74
@ XML_CHAR_ENCODING_8859_2
Definition: encoding.h:69
@ XML_CHAR_ENCODING_8859_4
Definition: encoding.h:71
@ XML_CHAR_ENCODING_8859_8
Definition: encoding.h:75
@ XML_CHAR_ENCODING_UTF16BE
Definition: encoding.h:61
@ XML_CHAR_ENCODING_UCS2
Definition: encoding.h:67
@ XML_CHAR_ENCODING_2022_JP
Definition: encoding.h:77
@ XML_CHAR_ENCODING_8859_3
Definition: encoding.h:70
@ XML_CHAR_ENCODING_EBCDIC
Definition: encoding.h:64
@ XML_CHAR_ENCODING_UCS4LE
Definition: encoding.h:62
@ XML_CHAR_ENCODING_ERROR
Definition: encoding.h:57
@ XML_CHAR_ENCODING_UCS4_3412
Definition: encoding.h:66
@ XML_CHAR_ENCODING_UCS4BE
Definition: encoding.h:63
@ XML_CHAR_ENCODING_8859_1
Definition: encoding.h:68
@ XML_CHAR_ENCODING_8859_9
Definition: encoding.h:76
@ XML_CHAR_ENCODING_UTF16LE
Definition: encoding.h:60
@ XML_CHAR_ENCODING_NONE
Definition: encoding.h:58
@ XML_CHAR_ENCODING_8859_5
Definition: encoding.h:72
@ XML_CHAR_ENCODING_ASCII
Definition: encoding.h:80
@ XML_CHAR_ENCODING_SHIFT_JIS
Definition: encoding.h:78
@ XML_CHAR_ENCODING_UCS4_2143
Definition: encoding.h:65
@ XML_CHAR_ENCODING_EUC_JP
Definition: encoding.h:79
XMLPUBFUN int XMLCALL xmlAddEncodingAlias(const char *name, const char *alias)
Definition: encoding.c:1077
XMLPUBFUN const char *XMLCALL xmlGetCharEncodingName(xmlCharEncoding enc)
Definition: encoding.c:1254
XML_DEPRECATED XMLPUBFUN void XMLCALL xmlCleanupCharEncodingHandlers(void)
Definition: encoding.c:1483
XMLPUBFUN xmlCharEncoding XMLCALL xmlParseCharEncoding(const char *name)
Definition: encoding.c:1170
XMLPUBFUN int XMLCALL xmlCharEncInFunc(xmlCharEncodingHandler *handler, xmlBufferPtr out, xmlBufferPtr in)
Definition: encoding.c:2383
XMLPUBFUN xmlCharEncoding XMLCALL xmlDetectCharEncoding(const unsigned char *in, int len)
Definition: encoding.c:952
XMLPUBFUN const char *XMLCALL xmlGetEncodingAlias(const char *alias)
Definition: encoding.c:1039
XMLPUBFUN int XMLCALL xmlDelEncodingAlias(const char *alias)
Definition: encoding.c:1134
int(* xmlCharEncodingInputFunc)(unsigned char *out, int *outlen, const unsigned char *in, int *inlen)
Definition: encoding.h:99
XMLPUBFUN int XMLCALL isolat1ToUTF8(unsigned char *out, int *outlen, const unsigned char *in, int *inlen)
Definition: encoding.c:316
XMLPUBFUN int XMLCALL xmlCharEncOutFunc(xmlCharEncodingHandler *handler, xmlBufferPtr out, xmlBufferPtr in)
Definition: encoding.c:2645
xmlCharEncodingHandler * xmlCharEncodingHandlerPtr
Definition: encoding.h:130
#define XMLCALL
GLuint in
Definition: glext.h:9616
GLenum GLsizei len
Definition: glext.h:6722
GLenum GLenum GLenum input
Definition: glext.h:9031
static FILE * out
Definition: regtests2xml.c:44
xmlCharEncodingOutputFunc output
Definition: encoding.h:134
xmlCharEncodingInputFunc input
Definition: encoding.h:133
Definition: name.c:39
#define XMLPUBFUN
Definition: xmlexports.h:61
#define XML_DEPRECATED
Definition: xmlversion.h:494