/opt/xml2/share/gtk-doc/html/libxml2
NameSizeModeActions
general.html54700644editdlrm
home.png6540644editdlrm
index.html43210644editdlrm
left.png4590644editdlrm
libxml2-c14n.html135460644editdlrm
libxml2-catalog.html365490644editdlrm
libxml2-chvalid.html198350644editdlrm
libxml2-debugXML.html333170644editdlrm
libxml2-dict.html135820644editdlrm
libxml2-DOCBparser.html173610644editdlrm
libxml2-encoding.html295150644editdlrm
libxml2-entities.html231260644editdlrm
libxml2-globals.html356420644editdlrm
libxml2-hash.html420550644editdlrm
libxml2-HTMLparser.html580950644editdlrm
libxml2-HTMLtree.html244160644editdlrm
libxml2-list.html255680644editdlrm
libxml2-nanoftp.html224030644editdlrm
libxml2-nanohttp.html166140644editdlrm
libxml2-parser.html1374950644editdlrm
libxml2-parserInternals.html1253570644editdlrm
libxml2-pattern.html193620644editdlrm
libxml2-relaxng.html352300644editdlrm
libxml2-SAX.html388750644editdlrm
libxml2-SAX2.html396590644editdlrm
libxml2-schemasInternals.html651190644editdlrm
libxml2-schematron.html171050644editdlrm
libxml2-threads.html128960644editdlrm
libxml2-tree.html2344020644editdlrm
libxml2-uri.html184340644editdlrm
libxml2-valid.html985040644editdlrm
libxml2-xinclude.html159200644editdlrm
libxml2-xlink.html173290644editdlrm
libxml2-xmlautomata.html351790644editdlrm
libxml2-xmlerror.html847130644editdlrm
libxml2-xmlexports.html35850644editdlrm
libxml2-xmlIO.html574960644editdlrm
libxml2-xmlmemory.html240120644editdlrm
libxml2-xmlmodule.html73700644editdlrm
libxml2-xmlreader.html1080930644editdlrm
libxml2-xmlregexp.html420130644editdlrm
libxml2-xmlsave.html148420644editdlrm
libxml2-xmlschemas.html425210644editdlrm
libxml2-xmlschemastypes.html444510644editdlrm
libxml2-xmlstring.html351130644editdlrm
libxml2-xmlunicode.html1065960644editdlrm
libxml2-xmlversion.html190260644editdlrm
libxml2-xmlwriter.html1120770644editdlrm
libxml2-xpath.html622850644editdlrm
libxml2-xpathInternals.html1449130644editdlrm
libxml2-xpointer.html254530644editdlrm
libxml2.devhelp3431850644editdlrm
right.png4720644editdlrm
style.css8200644editdlrm
up.png4060644editdlrm
Edit: /opt/xml2/share/gtk-doc/html/libxml2/libxml2-encoding.html (29515B)
encoding: interface for the encoding conversion functions

encoding

encoding - interface for the encoding conversion functions

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.

Author(s): Daniel Veillard

Synopsis

typedef struct _uconv_t uconv_t;
typedef enum xmlCharEncoding;
typedef struct _xmlCharEncodingHandler xmlCharEncodingHandler;
typedef xmlCharEncodingHandler * xmlCharEncodingHandlerPtr;
int	xmlDelEncodingAlias		(const char * alias);
const char *	xmlGetEncodingAlias	(const char * alias);
void	xmlRegisterCharEncodingHandler	(xmlCharEncodingHandlerPtr handler);
int	UTF8Toisolat1			(unsigned char * out, 
int * outlen,
const unsigned char * in,
int * inlen); void xmlInitCharEncodingHandlers (void); int xmlAddEncodingAlias (const char * name,
const char * alias); void xmlCleanupEncodingAliases (void); int xmlCharEncOutFunc (xmlCharEncodingHandler * handler,
xmlBufferPtr out,
xmlBufferPtr in); xmlCharEncoding xmlParseCharEncoding (const char * name); typedef int xmlCharEncodingInputFunc (unsigned char * out,
int * outlen,
const unsigned char * in,
int * inlen); void xmlCleanupCharEncodingHandlers (void); xmlCharEncodingHandlerPtr xmlNewCharEncodingHandler (const char * name,
xmlCharEncodingInputFunc input,
xmlCharEncodingOutputFunc output); typedef int xmlCharEncodingOutputFunc (unsigned char * out,
int * outlen,
const unsigned char * in,
int * inlen); int isolat1ToUTF8 (unsigned char * out,
int * outlen,
const unsigned char * in,
int * inlen); xmlCharEncodingHandlerPtr xmlFindCharEncodingHandler (const char * name); int xmlCharEncInFunc (xmlCharEncodingHandler * handler,
xmlBufferPtr out,
xmlBufferPtr in); xmlCharEncodingHandlerPtr xmlGetCharEncodingHandler (xmlCharEncoding enc); int xmlCharEncFirstLine (xmlCharEncodingHandler * handler,
xmlBufferPtr out,
xmlBufferPtr in); xmlCharEncoding xmlDetectCharEncoding (const unsigned char * in,
int len); int xmlCharEncCloseFunc (xmlCharEncodingHandler * handler); const char * xmlGetCharEncodingName (xmlCharEncoding enc);

Description

Details

Structure uconv_t

struct _uconv_t {
    UConverter *	uconv	: for conversion between an encoding and UTF-16
    UConverter *	utf8	: for conversion between UTF-8 and UTF-16
} uconv_t;


Enum xmlCharEncoding

enum xmlCharEncoding {
    XML_CHAR_ENCODING_ERROR = -1 /* No char encoding detected */
    XML_CHAR_ENCODING_NONE = 0 /* No char encoding detected */
    XML_CHAR_ENCODING_UTF8 = 1 /* UTF-8 */
    XML_CHAR_ENCODING_UTF16LE = 2 /* UTF-16 little endian */
    XML_CHAR_ENCODING_UTF16BE = 3 /* UTF-16 big endian */
    XML_CHAR_ENCODING_UCS4LE = 4 /* UCS-4 little endian */
    XML_CHAR_ENCODING_UCS4BE = 5 /* UCS-4 big endian */
    XML_CHAR_ENCODING_EBCDIC = 6 /* EBCDIC uh! */
    XML_CHAR_ENCODING_UCS4_2143 = 7 /* UCS-4 unusual ordering */
    XML_CHAR_ENCODING_UCS4_3412 = 8 /* UCS-4 unusual ordering */
    XML_CHAR_ENCODING_UCS2 = 9 /* UCS-2 */
    XML_CHAR_ENCODING_8859_1 = 10 /* ISO-8859-1 ISO Latin 1 */
    XML_CHAR_ENCODING_8859_2 = 11 /* ISO-8859-2 ISO Latin 2 */
    XML_CHAR_ENCODING_8859_3 = 12 /* ISO-8859-3 */
    XML_CHAR_ENCODING_8859_4 = 13 /* ISO-8859-4 */
    XML_CHAR_ENCODING_8859_5 = 14 /* ISO-8859-5 */
    XML_CHAR_ENCODING_8859_6 = 15 /* ISO-8859-6 */
    XML_CHAR_ENCODING_8859_7 = 16 /* ISO-8859-7 */
    XML_CHAR_ENCODING_8859_8 = 17 /* ISO-8859-8 */
    XML_CHAR_ENCODING_8859_9 = 18 /* ISO-8859-9 */
    XML_CHAR_ENCODING_2022_JP = 19 /* ISO-2022-JP */
    XML_CHAR_ENCODING_SHIFT_JIS = 20 /* Shift_JIS */
    XML_CHAR_ENCODING_EUC_JP = 21 /* EUC-JP */
    XML_CHAR_ENCODING_ASCII = 22 /*  pure ASCII */
};


Structure xmlCharEncodingHandler

struct _xmlCharEncodingHandler {
    char *	name
    xmlCharEncodingInputFunc	input
    xmlCharEncodingOutputFunc	output
    iconv_t	iconv_in
    iconv_t	iconv_out
    uconv_t *	uconv_in
    uconv_t *	uconv_out
} xmlCharEncodingHandler;


Typedef xmlCharEncodingHandlerPtr

xmlCharEncodingHandler * xmlCharEncodingHandlerPtr;







xmlCharEncCloseFunc ()

int	xmlCharEncCloseFunc		(xmlCharEncodingHandler * handler)

Generic front-end for encoding handler close function

handler:char enconding transformation data structure
Returns:0 if success, or -1 in case of error

xmlCharEncFirstLine ()

int	xmlCharEncFirstLine		(xmlCharEncodingHandler * handler, 
xmlBufferPtr out,
xmlBufferPtr in)

Front-end for the encoding handler input function, but handle only the very first line, i.e. limit itself to 45 chars.

handler:char enconding transformation data structure
out:an xmlBuffer for the output.
in:an xmlBuffer for the input
Returns:the number of byte written if success, or -1 general error -2 if the transcoding fails (for *in is not valid utf8 string or the result of transformation can't fit into the encoding we want), or

xmlCharEncInFunc ()

int	xmlCharEncInFunc		(xmlCharEncodingHandler * handler, 
xmlBufferPtr out,
xmlBufferPtr in)

Generic front-end for the encoding handler input function

handler:char encoding transformation data structure
out:an xmlBuffer for the output.
in:an xmlBuffer for the input
Returns:the number of byte written if success, or -1 general error -2 if the transcoding fails (for *in is not valid utf8 string or the result of transformation can't fit into the encoding we want), or

xmlCharEncOutFunc ()

int	xmlCharEncOutFunc		(xmlCharEncodingHandler * handler, 
xmlBufferPtr out,
xmlBufferPtr in)

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.

handler:char enconding transformation data structure
out:an xmlBuffer for the output.
in:an xmlBuffer for the input
Returns:the number of byte written if success, or -1 general error -2 if the transcoding fails (for *in is not valid utf8 string or the result of transformation can't fit into the encoding we want), or




xmlDetectCharEncoding ()

xmlCharEncoding	xmlDetectCharEncoding	(const unsigned char * in, 
int len)

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.

in: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).
len:pointer to the length of the buffer
Returns:one of the XML_CHAR_ENCODING_... values.

xmlFindCharEncodingHandler ()

xmlCharEncodingHandlerPtr	xmlFindCharEncodingHandler	(const char * name)

Search in the registered set the handler able to read/write that encoding.

name:a string describing the char encoding.
Returns:the handler or NULL if not found

xmlGetCharEncodingHandler ()

xmlCharEncodingHandlerPtr	xmlGetCharEncodingHandler	(xmlCharEncoding enc)

Search in the registered set the handler able to read/write that encoding.

enc:an xmlCharEncoding value.
Returns:the handler or NULL if not found

xmlGetCharEncodingName ()

const char *	xmlGetCharEncodingName	(xmlCharEncoding enc)

The "canonical" name for XML encoding. C.f. http://www.w3.org/TR/REC-xml#charencoding Section 4.3.3 Character Encoding in Entities

enc:the encoding
Returns:the canonical name for the given encoding



xmlNewCharEncodingHandler ()

xmlCharEncodingHandlerPtr	xmlNewCharEncodingHandler	(const char * name, 
xmlCharEncodingInputFunc input,
xmlCharEncodingOutputFunc output)

Create and registers an xmlCharEncodingHandler.

name:the encoding name, in UTF-8 format (ASCII actually)
input:the xmlCharEncodingInputFunc to read that encoding
output:the xmlCharEncodingOutputFunc to write that encoding
Returns:the xmlCharEncodingHandlerPtr created (or NULL in case of error).

xmlParseCharEncoding ()

xmlCharEncoding	xmlParseCharEncoding	(const char * name)

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.

name:the encoding name as parsed, in UTF-8 format (ASCII actually)
Returns:one of the XML_CHAR_ENCODING_... values or XML_CHAR_ENCODING_NONE if not recognized.

xmlRegisterCharEncodingHandler ()

void	xmlRegisterCharEncodingHandler	(xmlCharEncodingHandlerPtr handler)

Register the char encoding handler, surprising, isn't it ?

handler:the xmlCharEncodingHandlerPtr handler block