ReactOS 0.4.16-dev-2207-geb15453
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
35typedef enum {
43
44/*
45 * xmlCharEncoding:
46 *
47 * Predefined values for some standard encodings.
48 * Libxml does not do beforehand translation on UTF8 and ISOLatinX.
49 * It also supports ASCII, ISO-8859-1, and UTF16 (LE and BE) by default.
50 *
51 * Anything else would have to be translated to UTF8 before being
52 * given to the parser itself. The BOM for UTF16 and the encoding
53 * declaration are looked at and a converter is looked for at that
54 * point. If not found the parser stops here as asked by the XML REC. A
55 * converter can be registered by the user using xmlRegisterCharEncodingHandler
56 * but the current form doesn't allow stateful transcoding (a serious
57 * problem agreed !). If iconv has been found it will be used
58 * automatically and allow stateful transcoding, the simplest is then
59 * to be sure to enable iconv and to provide iconv libs for the encoding
60 * support needed.
61 *
62 * Note that the generic "UTF-16" is not a predefined value. Instead, only
63 * the specific UTF-16LE and UTF-16BE are present.
64 */
65typedef enum {
66 XML_CHAR_ENCODING_ERROR= -1, /* No char encoding detected */
67 XML_CHAR_ENCODING_NONE= 0, /* No char encoding detected */
68 XML_CHAR_ENCODING_UTF8= 1, /* UTF-8 */
69 XML_CHAR_ENCODING_UTF16LE= 2, /* UTF-16 little endian */
70 XML_CHAR_ENCODING_UTF16BE= 3, /* UTF-16 big endian */
71 XML_CHAR_ENCODING_UCS4LE= 4, /* UCS-4 little endian */
72 XML_CHAR_ENCODING_UCS4BE= 5, /* UCS-4 big endian */
73 XML_CHAR_ENCODING_EBCDIC= 6, /* EBCDIC uh! */
74 XML_CHAR_ENCODING_UCS4_2143=7, /* UCS-4 unusual ordering */
75 XML_CHAR_ENCODING_UCS4_3412=8, /* UCS-4 unusual ordering */
76 XML_CHAR_ENCODING_UCS2= 9, /* UCS-2 */
77 XML_CHAR_ENCODING_8859_1= 10,/* ISO-8859-1 ISO Latin 1 */
78 XML_CHAR_ENCODING_8859_2= 11,/* ISO-8859-2 ISO Latin 2 */
79 XML_CHAR_ENCODING_8859_3= 12,/* ISO-8859-3 */
80 XML_CHAR_ENCODING_8859_4= 13,/* ISO-8859-4 */
81 XML_CHAR_ENCODING_8859_5= 14,/* ISO-8859-5 */
82 XML_CHAR_ENCODING_8859_6= 15,/* ISO-8859-6 */
83 XML_CHAR_ENCODING_8859_7= 16,/* ISO-8859-7 */
84 XML_CHAR_ENCODING_8859_8= 17,/* ISO-8859-8 */
85 XML_CHAR_ENCODING_8859_9= 18,/* ISO-8859-9 */
86 XML_CHAR_ENCODING_2022_JP= 19,/* ISO-2022-JP */
87 XML_CHAR_ENCODING_SHIFT_JIS=20,/* Shift_JIS */
88 XML_CHAR_ENCODING_EUC_JP= 21,/* EUC-JP */
89 XML_CHAR_ENCODING_ASCII= 22 /* pure ASCII */
91
108typedef int (* xmlCharEncodingInputFunc)(unsigned char *out, int *outlen,
109 const unsigned char *in, int *inlen);
110
111
130typedef int (* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen,
131 const unsigned char *in, int *inlen);
132
133
134/*
135 * Block defining the handlers for non UTF-8 encodings.
136 * If iconv is supported, there are two extra fields.
137 */
141 char *name;
144#ifdef LIBXML_ICONV_ENABLED
145 iconv_t iconv_in;
146 iconv_t iconv_out;
147#endif /* LIBXML_ICONV_ENABLED */
148#ifdef LIBXML_ICU_ENABLED
149 struct _uconv_t *uconv_in;
150 struct _uconv_t *uconv_out;
151#endif /* LIBXML_ICU_ENABLED */
152};
153
154/*
155 * Interfaces for encoding handlers.
156 */
158XMLPUBFUN void
161XMLPUBFUN void
163XMLPUBFUN void
168 xmlFindCharEncodingHandler (const char *name);
170 xmlNewCharEncodingHandler (const char *name,
173
174/*
175 * Interfaces for encoding names and aliases.
176 */
177XMLPUBFUN int
178 xmlAddEncodingAlias (const char *name,
179 const char *alias);
180XMLPUBFUN int
181 xmlDelEncodingAlias (const char *alias);
182XMLPUBFUN const char *
183 xmlGetEncodingAlias (const char *alias);
184XMLPUBFUN void
187 xmlParseCharEncoding (const char *name);
188XMLPUBFUN const char *
190
191/*
192 * Interfaces directly used by the parsers.
193 */
195 xmlDetectCharEncoding (const unsigned char *in,
196 int len);
197
198struct _xmlBuffer;
199XMLPUBFUN int
201 struct _xmlBuffer *out,
202 struct _xmlBuffer *in);
203
204XMLPUBFUN int
206 struct _xmlBuffer *out,
207 struct _xmlBuffer *in);
209XMLPUBFUN int
211 struct _xmlBuffer *out,
212 struct _xmlBuffer *in);
213XMLPUBFUN int
215
216/*
217 * Export a few useful functions
218 */
219#ifdef LIBXML_OUTPUT_ENABLED
220XMLPUBFUN int
221 UTF8Toisolat1 (unsigned char *out,
222 int *outlen,
223 const unsigned char *in,
224 int *inlen);
225#endif /* LIBXML_OUTPUT_ENABLED */
226XMLPUBFUN int
227 isolat1ToUTF8 (unsigned char *out,
228 int *outlen,
229 const unsigned char *in,
230 int *inlen);
231#ifdef __cplusplus
232}
233#endif
234
235#endif /* __XML_CHAR_ENCODING_H__ */
const WCHAR * alias
Definition: main.c:67
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7512
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
XMLPUBFUN void xmlRegisterCharEncodingHandler(xmlCharEncodingHandlerPtr handler)
Definition: encoding.c:1515
int(* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen, const unsigned char *in, int *inlen)
Definition: encoding.h:130
XMLPUBFUN xmlCharEncoding xmlDetectCharEncoding(const unsigned char *in, int len)
Definition: encoding.c:916
XMLPUBFUN int xmlCharEncInFunc(xmlCharEncodingHandler *handler, struct _xmlBuffer *out, struct _xmlBuffer *in)
XMLPUBFUN xmlCharEncoding xmlParseCharEncoding(const char *name)
Definition: encoding.c:1148
XML_DEPRECATED XMLPUBFUN void xmlCleanupCharEncodingHandlers(void)
Definition: encoding.c:1490
XMLPUBFUN int xmlDelEncodingAlias(const char *alias)
Definition: encoding.c:1112
XML_DEPRECATED XMLPUBFUN void xmlInitCharEncodingHandlers(void)
Definition: encoding.c:1460
xmlCharEncoding
Definition: encoding.h:65
@ XML_CHAR_ENCODING_8859_6
Definition: encoding.h:82
@ XML_CHAR_ENCODING_UTF8
Definition: encoding.h:68
@ XML_CHAR_ENCODING_8859_7
Definition: encoding.h:83
@ XML_CHAR_ENCODING_8859_2
Definition: encoding.h:78
@ XML_CHAR_ENCODING_8859_4
Definition: encoding.h:80
@ XML_CHAR_ENCODING_8859_8
Definition: encoding.h:84
@ XML_CHAR_ENCODING_UTF16BE
Definition: encoding.h:70
@ XML_CHAR_ENCODING_UCS2
Definition: encoding.h:76
@ XML_CHAR_ENCODING_2022_JP
Definition: encoding.h:86
@ XML_CHAR_ENCODING_8859_3
Definition: encoding.h:79
@ XML_CHAR_ENCODING_EBCDIC
Definition: encoding.h:73
@ XML_CHAR_ENCODING_UCS4LE
Definition: encoding.h:71
@ XML_CHAR_ENCODING_ERROR
Definition: encoding.h:66
@ XML_CHAR_ENCODING_UCS4_3412
Definition: encoding.h:75
@ XML_CHAR_ENCODING_UCS4BE
Definition: encoding.h:72
@ XML_CHAR_ENCODING_8859_1
Definition: encoding.h:77
@ XML_CHAR_ENCODING_8859_9
Definition: encoding.h:85
@ XML_CHAR_ENCODING_UTF16LE
Definition: encoding.h:69
@ XML_CHAR_ENCODING_NONE
Definition: encoding.h:67
@ XML_CHAR_ENCODING_8859_5
Definition: encoding.h:81
@ XML_CHAR_ENCODING_ASCII
Definition: encoding.h:89
@ XML_CHAR_ENCODING_SHIFT_JIS
Definition: encoding.h:87
@ XML_CHAR_ENCODING_UCS4_2143
Definition: encoding.h:74
@ XML_CHAR_ENCODING_EUC_JP
Definition: encoding.h:88
XMLPUBFUN void xmlCleanupEncodingAliases(void)
Definition: encoding.c:976
xmlCharEncError
Definition: encoding.h:35
@ XML_ENC_ERR_SPACE
Definition: encoding.h:37
@ XML_ENC_ERR_PARTIAL
Definition: encoding.h:39
@ XML_ENC_ERR_MEMORY
Definition: encoding.h:41
@ XML_ENC_ERR_INPUT
Definition: encoding.h:38
@ XML_ENC_ERR_SUCCESS
Definition: encoding.h:36
@ XML_ENC_ERR_INTERNAL
Definition: encoding.h:40
XMLPUBFUN int xmlAddEncodingAlias(const char *name, const char *alias)
Definition: encoding.c:1041
XML_DEPRECATED XMLPUBFUN int xmlCharEncFirstLine(xmlCharEncodingHandler *handler, struct _xmlBuffer *out, struct _xmlBuffer *in)
XMLPUBFUN xmlCharEncodingHandlerPtr xmlNewCharEncodingHandler(const char *name, xmlCharEncodingInputFunc input, xmlCharEncodingOutputFunc output)
Definition: encoding.c:1394
XMLPUBFUN const char * xmlGetEncodingAlias(const char *alias)
Definition: encoding.c:1003
XMLPUBFUN int xmlCharEncOutFunc(xmlCharEncodingHandler *handler, struct _xmlBuffer *out, struct _xmlBuffer *in)
XMLPUBFUN xmlCharEncodingHandlerPtr xmlFindCharEncodingHandler(const char *name)
Definition: encoding.c:1677
XMLPUBFUN xmlCharEncodingHandlerPtr xmlGetCharEncodingHandler(xmlCharEncoding enc)
Definition: encoding.c:1547
XMLPUBFUN int isolat1ToUTF8(unsigned char *out, int *outlen, const unsigned char *in, int *inlen)
Definition: encoding.c:283
XMLPUBFUN int xmlCharEncCloseFunc(xmlCharEncodingHandler *handler)
XMLPUBFUN const char * xmlGetCharEncodingName(xmlCharEncoding enc)
Definition: encoding.c:1229
int(* xmlCharEncodingInputFunc)(unsigned char *out, int *outlen, const unsigned char *in, int *inlen)
Definition: encoding.h:108
xmlCharEncodingHandler * xmlCharEncodingHandlerPtr
Definition: encoding.h:139
GLuint in
Definition: glext.h:9616
GLenum GLsizei len
Definition: glext.h:6722
GLenum GLenum GLenum input
Definition: glext.h:9031
xmlCharEncodingOutputFunc output
Definition: encoding.h:143
xmlCharEncodingInputFunc input
Definition: encoding.h:142
Definition: name.c:39
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
#define XMLPUBFUN
Definition: xmlexports.h:30
#define XML_DEPRECATED
Definition: xmlversion.h:475