Gnome XML Library Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# encoding

## Name

encoding --

## Synopsis

    enum        xmlCharEncoding;
    int         (*xmlCharEncodingInputFunc)     (unsigned char *out,
                                                 int outlen,
                                                 unsigned char *in,
                                                 int inlen);
    int         (*xmlCharEncodingOutputFunc)    (unsigned char *out,
                                                 int outlen,
                                                 unsigned char *in,
                                                 int inlen);
    struct      xmlCharEncodingHandler;
    typedef     xmlCharEncodingHandlerPtr;
    void        xmlInitCharEncodingHandlers     (void);
    void        xmlCleanupCharEncodingHandlers  (void);
    void        xmlRegisterCharEncodingHandler  (xmlCharEncodingHandlerPtr handler);
    xmlCharEncoding xmlDetectCharEncoding       (unsigned char *in);
    xmlCharEncoding xmlParseCharEncoding        (const char *name);
    xmlCharEncodingHandlerPtr xmlGetCharEncodingHandler
                                                (xmlCharEncoding enc);
    xmlCharEncodingHandlerPtr xmlFindCharEncodingHandler
                                                (const char *name);

## Description

## Details

### enum xmlCharEncoding

    typedef enum {
        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 */
    } xmlCharEncoding;

### xmlCharEncodingInputFunc ()

    int         (*xmlCharEncodingInputFunc)     (unsigned char *out,
                                                 int outlen,
                                                 unsigned char *in,
                                                 int inlen);

`out` : |
`outlen` : |
`in` : |
`inlen` : |
Returns : |

### xmlCharEncodingOutputFunc ()

    int         (*xmlCharEncodingOutputFunc)    (unsigned char *out,
                                                 int outlen,
                                                 unsigned char *in,
                                                 int inlen);

`out` : |
`outlen` : |
`in` : |
`inlen` : |
Returns : |

### struct xmlCharEncodingHandler

    struct xmlCharEncodingHandler {
        char                       *name;
        xmlCharEncodingInputFunc   input;
        xmlCharEncodingOutputFunc output;
    };

### xmlCharEncodingHandlerPtr

    typedef xmlCharEncodingHandler *xmlCharEncodingHandlerPtr;

### xmlInitCharEncodingHandlers ()

    void        xmlInitCharEncodingHandlers     (void);

Initialize the char encoding support, it registers the default encoding supported. NOTE: while public, this function usually doesn't need to be called in normal processing.

### xmlCleanupCharEncodingHandlers ()

    void        xmlCleanupCharEncodingHandlers  (void);

Cleanup the memory allocated for the char encoding support, it unregisters all the encoding handlers.

### xmlRegisterCharEncodingHandler ()

    void        xmlRegisterCharEncodingHandler  (xmlCharEncodingHandlerPtr handler);

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

`handler` : | the xmlCharEncodingHandlerPtr handler block

### xmlDetectCharEncoding ()

    xmlCharEncoding xmlDetectCharEncoding       (unsigned char *in);

Guess the encoding of the entity using the first bytes of the entity content accordingly of 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 4 bytes long.
Returns : | one of the XML_CHAR_ENCODING_... values.

### xmlParseCharEncoding ()

    xmlCharEncoding xmlParseCharEncoding        (const char *name);

Conpare the string to the known 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.

### xmlGetCharEncodingHandler ()

    xmlCharEncodingHandlerPtr xmlGetCharEncodingHandler
                                                (xmlCharEncoding enc);

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

`enc` : | a string describing the char encoding.
Returns : | the handler or NULL if not found

### xmlFindCharEncodingHandler ()

    xmlCharEncodingHandlerPtr xmlFindCharEncodingHandler
                                                (const char *name);

`name` : |
Returns : |

<<< Previous Page | Home | Up | Next Page >>>
parserInternals | debugXML