Blame encoding.c

Packit Service a31ea6
/*
Packit Service a31ea6
 * encoding.c : implements the encoding conversion functions needed for XML
Packit Service a31ea6
 *
Packit Service a31ea6
 * Related specs:
Packit Service a31ea6
 * rfc2044        (UTF-8 and UTF-16) F. Yergeau Alis Technologies
Packit Service a31ea6
 * rfc2781        UTF-16, an encoding of ISO 10646, P. Hoffman, F. Yergeau
Packit Service a31ea6
 * [ISO-10646]    UTF-8 and UTF-16 in Annexes
Packit Service a31ea6
 * [ISO-8859-1]   ISO Latin-1 characters codes.
Packit Service a31ea6
 * [UNICODE]      The Unicode Consortium, "The Unicode Standard --
Packit Service a31ea6
 *                Worldwide Character Encoding -- Version 1.0", Addison-
Packit Service a31ea6
 *                Wesley, Volume 1, 1991, Volume 2, 1992.  UTF-8 is
Packit Service a31ea6
 *                described in Unicode Technical Report #4.
Packit Service a31ea6
 * [US-ASCII]     Coded Character Set--7-bit American Standard Code for
Packit Service a31ea6
 *                Information Interchange, ANSI X3.4-1986.
Packit Service a31ea6
 *
Packit Service a31ea6
 * See Copyright for the status of this software.
Packit Service a31ea6
 *
Packit Service a31ea6
 * daniel@veillard.com
Packit Service a31ea6
 *
Packit Service a31ea6
 * Original code for IsoLatin1 and UTF-16 by "Martin J. Duerst" <duerst@w3.org>
Packit Service a31ea6
 */
Packit Service a31ea6
Packit Service a31ea6
#define IN_LIBXML
Packit Service a31ea6
#include "libxml.h"
Packit Service a31ea6
Packit Service a31ea6
#include <string.h>
Packit Service a31ea6
#include <limits.h>
Packit Service a31ea6
Packit Service a31ea6
#ifdef HAVE_CTYPE_H
Packit Service a31ea6
#include <ctype.h>
Packit Service a31ea6
#endif
Packit Service a31ea6
#ifdef HAVE_STDLIB_H
Packit Service a31ea6
#include <stdlib.h>
Packit Service a31ea6
#endif
Packit Service a31ea6
#ifdef LIBXML_ICONV_ENABLED
Packit Service a31ea6
#ifdef HAVE_ERRNO_H
Packit Service a31ea6
#include <errno.h>
Packit Service a31ea6
#endif
Packit Service a31ea6
#endif
Packit Service a31ea6
#include <libxml/encoding.h>
Packit Service a31ea6
#include <libxml/xmlmemory.h>
Packit Service a31ea6
#ifdef LIBXML_HTML_ENABLED
Packit Service a31ea6
#include <libxml/HTMLparser.h>
Packit Service a31ea6
#endif
Packit Service a31ea6
#include <libxml/globals.h>
Packit Service a31ea6
#include <libxml/xmlerror.h>
Packit Service a31ea6
Packit Service a31ea6
#include "buf.h"
Packit Service a31ea6
#include "enc.h"
Packit Service a31ea6
Packit Service a31ea6
static xmlCharEncodingHandlerPtr xmlUTF16LEHandler = NULL;
Packit Service a31ea6
static xmlCharEncodingHandlerPtr xmlUTF16BEHandler = NULL;
Packit Service a31ea6
Packit Service a31ea6
typedef struct _xmlCharEncodingAlias xmlCharEncodingAlias;
Packit Service a31ea6
typedef xmlCharEncodingAlias *xmlCharEncodingAliasPtr;
Packit Service a31ea6
struct _xmlCharEncodingAlias {
Packit Service a31ea6
    const char *name;
Packit Service a31ea6
    const char *alias;
Packit Service a31ea6
};
Packit Service a31ea6
Packit Service a31ea6
static xmlCharEncodingAliasPtr xmlCharEncodingAliases = NULL;
Packit Service a31ea6
static int xmlCharEncodingAliasesNb = 0;
Packit Service a31ea6
static int xmlCharEncodingAliasesMax = 0;
Packit Service a31ea6
Packit Service a31ea6
#if defined(LIBXML_ICONV_ENABLED) || defined(LIBXML_ICU_ENABLED)
Packit Service a31ea6
#if 0
Packit Service a31ea6
#define DEBUG_ENCODING  /* Define this to get encoding traces */
Packit Service a31ea6
#endif
Packit Service a31ea6
#else
Packit Service a31ea6
#ifdef LIBXML_ISO8859X_ENABLED
Packit Service a31ea6
static void xmlRegisterCharEncodingHandlersISO8859x (void);
Packit Service a31ea6
#endif
Packit Service a31ea6
#endif
Packit Service a31ea6
Packit Service a31ea6
static int xmlLittleEndian = 1;
Packit Service a31ea6
Packit Service a31ea6
/**
Packit Service a31ea6
 * xmlEncodingErrMemory:
Packit Service a31ea6
 * @extra:  extra informations
Packit Service a31ea6
 *
Packit Service a31ea6
 * Handle an out of memory condition
Packit Service a31ea6
 */
Packit Service a31ea6
static void
Packit Service a31ea6
xmlEncodingErrMemory(const char *extra)
Packit Service a31ea6
{
Packit Service a31ea6
    __xmlSimpleError(XML_FROM_I18N, XML_ERR_NO_MEMORY, NULL, NULL, extra);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
/**
Packit Service a31ea6
 * xmlErrEncoding:
Packit Service a31ea6
 * @error:  the error number
Packit Service a31ea6
 * @msg:  the error message
Packit Service a31ea6
 *
Packit Service a31ea6
 * n encoding error
Packit Service a31ea6
 */
Packit Service a31ea6
static void LIBXML_ATTR_FORMAT(2,0)
Packit Service a31ea6
xmlEncodingErr(xmlParserErrors error, const char *msg, const char *val)
Packit Service a31ea6
{
Packit Service a31ea6
    __xmlRaiseError(NULL, NULL, NULL, NULL, NULL,
Packit Service a31ea6
                    XML_FROM_I18N, error, XML_ERR_FATAL,
Packit Service a31ea6
                    NULL, 0, val, NULL, NULL, 0, 0, msg, val);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
#ifdef LIBXML_ICU_ENABLED
Packit Service a31ea6
static uconv_t*
Packit Service a31ea6
openIcuConverter(const char* name, int toUnicode)
Packit Service a31ea6
{
Packit Service a31ea6
  UErrorCode status = U_ZERO_ERROR;
Packit Service a31ea6
  uconv_t *conv = (uconv_t *) xmlMalloc(sizeof(uconv_t));
Packit Service a31ea6
  if (conv == NULL)
Packit Service a31ea6
    return NULL;
Packit Service a31ea6
Packit Service a31ea6
  conv->uconv = ucnv_open(name, &status);
Packit Service a31ea6
  if (U_FAILURE(status))
Packit Service a31ea6
    goto error;
Packit Service a31ea6
Packit Service a31ea6
  status = U_ZERO_ERROR;
Packit Service a31ea6
  if (toUnicode) {
Packit Service a31ea6
    ucnv_setToUCallBack(conv->uconv, UCNV_TO_U_CALLBACK_STOP,
Packit Service a31ea6
                        NULL, NULL, NULL, &status);
Packit Service a31ea6
  }
Packit Service a31ea6
  else {
Packit Service a31ea6
    ucnv_setFromUCallBack(conv->uconv, UCNV_FROM_U_CALLBACK_STOP,
Packit Service a31ea6
                        NULL, NULL, NULL, &status);
Packit Service a31ea6
  }
Packit Service a31ea6
  if (U_FAILURE(status))
Packit Service a31ea6
    goto error;
Packit Service a31ea6
Packit Service a31ea6
  status = U_ZERO_ERROR;
Packit Service a31ea6
  conv->utf8 = ucnv_open("UTF-8", &status);
Packit Service a31ea6
  if (U_SUCCESS(status))
Packit Service a31ea6
    return conv;
Packit Service a31ea6
Packit Service a31ea6
error:
Packit Service a31ea6
  if (conv->uconv)
Packit Service a31ea6
    ucnv_close(conv->uconv);
Packit Service a31ea6
  xmlFree(conv);
Packit Service a31ea6
  return NULL;
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
static void
Packit Service a31ea6
closeIcuConverter(uconv_t *conv)
Packit Service a31ea6
{
Packit Service a31ea6
  if (conv != NULL) {
Packit Service a31ea6
    ucnv_close(conv->uconv);
Packit Service a31ea6
    ucnv_close(conv->utf8);
Packit Service a31ea6
    xmlFree(conv);
Packit Service a31ea6
  }
Packit Service a31ea6
}
Packit Service a31ea6
#endif /* LIBXML_ICU_ENABLED */
Packit Service a31ea6
Packit Service a31ea6
/************************************************************************
Packit Service a31ea6
 *									*
Packit Service a31ea6
 *		Conversions To/From UTF8 encoding			*
Packit Service a31ea6
 *									*
Packit Service a31ea6
 ************************************************************************/
Packit Service a31ea6
Packit Service a31ea6
/**
Packit Service a31ea6
 * asciiToUTF8:
Packit Service a31ea6
 * @out:  a pointer to an array of bytes to store the result
Packit Service a31ea6
 * @outlen:  the length of @out
Packit Service a31ea6
 * @in:  a pointer to an array of ASCII chars
Packit Service a31ea6
 * @inlen:  the length of @in
Packit Service a31ea6
 *
Packit Service a31ea6
 * Take a block of ASCII chars in and try to convert it to an UTF-8
Packit Service a31ea6
 * block of chars out.
Packit Service a31ea6
 * Returns 0 if success, or -1 otherwise
Packit Service a31ea6
 * The value of @inlen after return is the number of octets consumed
Packit Service a31ea6
 *     if the return value is positive, else unpredictable.
Packit Service a31ea6
 * The value of @outlen after return is the number of octets consumed.
Packit Service a31ea6
 */
Packit Service a31ea6
static int
Packit Service a31ea6
asciiToUTF8(unsigned char* out, int *outlen,
Packit Service a31ea6
              const unsigned char* in, int *inlen) {
Packit Service a31ea6
    unsigned char* outstart = out;
Packit Service a31ea6
    const unsigned char* base = in;
Packit Service a31ea6
    const unsigned char* processed = in;
Packit Service a31ea6
    unsigned char* outend = out + *outlen;
Packit Service a31ea6
    const unsigned char* inend;
Packit Service a31ea6
    unsigned int c;
Packit Service a31ea6
Packit Service a31ea6
    inend = in + (*inlen);
Packit Service a31ea6
    while ((in < inend) && (out - outstart + 5 < *outlen)) {
Packit Service a31ea6
	c= *in++;
Packit Service a31ea6
Packit Service a31ea6
        if (out >= outend)
Packit Service a31ea6
	    break;
Packit Service a31ea6
        if (c < 0x80) {
Packit Service a31ea6
	    *out++ = c;
Packit Service a31ea6
	} else {
Packit Service a31ea6
	    *outlen = out - outstart;
Packit Service a31ea6
	    *inlen = processed - base;
Packit Service a31ea6
	    return(-1);
Packit Service a31ea6
	}
Packit Service a31ea6
Packit Service a31ea6
	processed = (const unsigned char*) in;
Packit Service a31ea6
    }
Packit Service a31ea6
    *outlen = out - outstart;
Packit Service a31ea6
    *inlen = processed - base;
Packit Service a31ea6
    return(*outlen);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
#ifdef LIBXML_OUTPUT_ENABLED
Packit Service a31ea6
/**
Packit Service a31ea6
 * UTF8Toascii:
Packit Service a31ea6
 * @out:  a pointer to an array of bytes to store the result
Packit Service a31ea6
 * @outlen:  the length of @out
Packit Service a31ea6
 * @in:  a pointer to an array of UTF-8 chars
Packit Service a31ea6
 * @inlen:  the length of @in
Packit Service a31ea6
 *
Packit Service a31ea6
 * Take a block of UTF-8 chars in and try to convert it to an ASCII
Packit Service a31ea6
 * block of chars out.
Packit Service a31ea6
 *
Packit Service a31ea6
 * Returns 0 if success, -2 if the transcoding fails, or -1 otherwise
Packit Service a31ea6
 * The value of @inlen after return is the number of octets consumed
Packit Service a31ea6
 *     if the return value is positive, else unpredictable.
Packit Service a31ea6
 * The value of @outlen after return is the number of octets consumed.
Packit Service a31ea6
 */
Packit Service a31ea6
static int
Packit Service a31ea6
UTF8Toascii(unsigned char* out, int *outlen,
Packit Service a31ea6
              const unsigned char* in, int *inlen) {
Packit Service a31ea6
    const unsigned char* processed = in;
Packit Service a31ea6
    const unsigned char* outend;
Packit Service a31ea6
    const unsigned char* outstart = out;
Packit Service a31ea6
    const unsigned char* instart = in;
Packit Service a31ea6
    const unsigned char* inend;
Packit Service a31ea6
    unsigned int c, d;
Packit Service a31ea6
    int trailing;
Packit Service a31ea6
Packit Service a31ea6
    if ((out == NULL) || (outlen == NULL) || (inlen == NULL)) return(-1);
Packit Service a31ea6
    if (in == NULL) {
Packit Service a31ea6
        /*
Packit Service a31ea6
	 * initialization nothing to do
Packit Service a31ea6
	 */
Packit Service a31ea6
	*outlen = 0;
Packit Service a31ea6
	*inlen = 0;
Packit Service a31ea6
	return(0);
Packit Service a31ea6
    }
Packit Service a31ea6
    inend = in + (*inlen);
Packit Service a31ea6
    outend = out + (*outlen);
Packit Service a31ea6
    while (in < inend) {
Packit Service a31ea6
	d = *in++;
Packit Service a31ea6
	if      (d < 0x80)  { c= d; trailing= 0; }
Packit Service a31ea6
	else if (d < 0xC0) {
Packit Service a31ea6
	    /* trailing byte in leading position */
Packit Service a31ea6
	    *outlen = out - outstart;
Packit Service a31ea6
	    *inlen = processed - instart;
Packit Service a31ea6
	    return(-2);
Packit Service a31ea6
        } else if (d < 0xE0)  { c= d & 0x1F; trailing= 1; }
Packit Service a31ea6
        else if (d < 0xF0)  { c= d & 0x0F; trailing= 2; }
Packit Service a31ea6
        else if (d < 0xF8)  { c= d & 0x07; trailing= 3; }
Packit Service a31ea6
	else {
Packit Service a31ea6
	    /* no chance for this in Ascii */
Packit Service a31ea6
	    *outlen = out - outstart;
Packit Service a31ea6
	    *inlen = processed - instart;
Packit Service a31ea6
	    return(-2);
Packit Service a31ea6
	}
Packit Service a31ea6
Packit Service a31ea6
	if (inend - in < trailing) {
Packit Service a31ea6
	    break;
Packit Service a31ea6
	}
Packit Service a31ea6
Packit Service a31ea6
	for ( ; trailing; trailing--) {
Packit Service a31ea6
	    if ((in >= inend) || (((d= *in++) & 0xC0) != 0x80))
Packit Service a31ea6
		break;
Packit Service a31ea6
	    c <<= 6;
Packit Service a31ea6
	    c |= d & 0x3F;
Packit Service a31ea6
	}
Packit Service a31ea6
Packit Service a31ea6
	/* assertion: c is a single UTF-4 value */
Packit Service a31ea6
	if (c < 0x80) {
Packit Service a31ea6
	    if (out >= outend)
Packit Service a31ea6
		break;
Packit Service a31ea6
	    *out++ = c;
Packit Service a31ea6
	} else {
Packit Service a31ea6
	    /* no chance for this in Ascii */
Packit Service a31ea6
	    *outlen = out - outstart;
Packit Service a31ea6
	    *inlen = processed - instart;
Packit Service a31ea6
	    return(-2);
Packit Service a31ea6
	}
Packit Service a31ea6
	processed = in;
Packit Service a31ea6
    }
Packit Service a31ea6
    *outlen = out - outstart;
Packit Service a31ea6
    *inlen = processed - instart;
Packit Service a31ea6
    return(*outlen);
Packit Service a31ea6
}
Packit Service a31ea6
#endif /* LIBXML_OUTPUT_ENABLED */
Packit Service a31ea6
Packit Service a31ea6
/**
Packit Service a31ea6
 * isolat1ToUTF8:
Packit Service a31ea6
 * @out:  a pointer to an array of bytes to store the result
Packit Service a31ea6
 * @outlen:  the length of @out
Packit Service a31ea6
 * @in:  a pointer to an array of ISO Latin 1 chars
Packit Service a31ea6
 * @inlen:  the length of @in
Packit Service a31ea6
 *
Packit Service a31ea6
 * Take a block of ISO Latin 1 chars in and try to convert it to an UTF-8
Packit Service a31ea6
 * block of chars out.
Packit Service a31ea6
 * Returns the number of bytes written if success, or -1 otherwise
Packit Service a31ea6
 * The value of @inlen after return is the number of octets consumed
Packit Service a31ea6
 *     if the return value is positive, else unpredictable.
Packit Service a31ea6
 * The value of @outlen after return is the number of octets consumed.
Packit Service a31ea6
 */
Packit Service a31ea6
int
Packit Service a31ea6
isolat1ToUTF8(unsigned char* out, int *outlen,
Packit Service a31ea6
              const unsigned char* in, int *inlen) {
Packit Service a31ea6
    unsigned char* outstart = out;
Packit Service a31ea6
    const unsigned char* base = in;
Packit Service a31ea6
    unsigned char* outend;
Packit Service a31ea6
    const unsigned char* inend;
Packit Service a31ea6
    const unsigned char* instop;
Packit Service a31ea6
Packit Service a31ea6
    if ((out == NULL) || (in == NULL) || (outlen == NULL) || (inlen == NULL))
Packit Service a31ea6
	return(-1);
Packit Service a31ea6
Packit Service a31ea6
    outend = out + *outlen;
Packit Service a31ea6
    inend = in + (*inlen);
Packit Service a31ea6
    instop = inend;
Packit Service a31ea6
Packit Service a31ea6
    while ((in < inend) && (out < outend - 1)) {
Packit Service a31ea6
	if (*in >= 0x80) {
Packit Service a31ea6
	    *out++ = (((*in) >>  6) & 0x1F) | 0xC0;
Packit Service a31ea6
            *out++ = ((*in) & 0x3F) | 0x80;
Packit Service a31ea6
	    ++in;
Packit Service a31ea6
	}
Packit Service a31ea6
	if ((instop - in) > (outend - out)) instop = in + (outend - out);
Packit Service a31ea6
	while ((in < instop) && (*in < 0x80)) {
Packit Service a31ea6
	    *out++ = *in++;
Packit Service a31ea6
	}
Packit Service a31ea6
    }
Packit Service a31ea6
    if ((in < inend) && (out < outend) && (*in < 0x80)) {
Packit Service a31ea6
        *out++ = *in++;
Packit Service a31ea6
    }
Packit Service a31ea6
    *outlen = out - outstart;
Packit Service a31ea6
    *inlen = in - base;
Packit Service a31ea6
    return(*outlen);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
/**
Packit Service a31ea6
 * UTF8ToUTF8:
Packit Service a31ea6
 * @out:  a pointer to an array of bytes to store the result
Packit Service a31ea6
 * @outlen:  the length of @out
Packit Service a31ea6
 * @inb:  a pointer to an array of UTF-8 chars
Packit Service a31ea6
 * @inlenb:  the length of @in in UTF-8 chars
Packit Service a31ea6
 *
Packit Service a31ea6
 * No op copy operation for UTF8 handling.
Packit Service a31ea6
 *
Packit Service a31ea6
 * Returns the number of bytes written, or -1 if lack of space.
Packit Service a31ea6
 *     The value of *inlen after return is the number of octets consumed
Packit Service a31ea6
 *     if the return value is positive, else unpredictable.
Packit Service a31ea6
 */
Packit Service a31ea6
static int
Packit Service a31ea6
UTF8ToUTF8(unsigned char* out, int *outlen,
Packit Service a31ea6
           const unsigned char* inb, int *inlenb)
Packit Service a31ea6
{
Packit Service a31ea6
    int len;
Packit Service a31ea6
Packit Service a31ea6
    if ((out == NULL) || (outlen == NULL) || (inlenb == NULL))
Packit Service a31ea6
	return(-1);
Packit Service a31ea6
    if (inb == NULL) {
Packit Service a31ea6
        /* inb == NULL means output is initialized. */
Packit Service a31ea6
        *outlen = 0;
Packit Service a31ea6
        *inlenb = 0;
Packit Service a31ea6
        return(0);
Packit Service a31ea6
    }
Packit Service a31ea6
    if (*outlen > *inlenb) {
Packit Service a31ea6
	len = *inlenb;
Packit Service a31ea6
    } else {
Packit Service a31ea6
	len = *outlen;
Packit Service a31ea6
    }
Packit Service a31ea6
    if (len < 0)
Packit Service a31ea6
	return(-1);
Packit Service a31ea6
Packit Service a31ea6
    memcpy(out, inb, len);
Packit Service a31ea6
Packit Service a31ea6
    *outlen = len;
Packit Service a31ea6
    *inlenb = len;
Packit Service a31ea6
    return(*outlen);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
Packit Service a31ea6
#ifdef LIBXML_OUTPUT_ENABLED
Packit Service a31ea6
/**
Packit Service a31ea6
 * UTF8Toisolat1:
Packit Service a31ea6
 * @out:  a pointer to an array of bytes to store the result
Packit Service a31ea6
 * @outlen:  the length of @out
Packit Service a31ea6
 * @in:  a pointer to an array of UTF-8 chars
Packit Service a31ea6
 * @inlen:  the length of @in
Packit Service a31ea6
 *
Packit Service a31ea6
 * Take a block of UTF-8 chars in and try to convert it to an ISO Latin 1
Packit Service a31ea6
 * block of chars out.
Packit Service a31ea6
 *
Packit Service a31ea6
 * Returns the number of bytes written if success, -2 if the transcoding fails,
Packit Service a31ea6
           or -1 otherwise
Packit Service a31ea6
 * The value of @inlen after return is the number of octets consumed
Packit Service a31ea6
 *     if the return value is positive, else unpredictable.
Packit Service a31ea6
 * The value of @outlen after return is the number of octets consumed.
Packit Service a31ea6
 */
Packit Service a31ea6
int
Packit Service a31ea6
UTF8Toisolat1(unsigned char* out, int *outlen,
Packit Service a31ea6
              const unsigned char* in, int *inlen) {
Packit Service a31ea6
    const unsigned char* processed = in;
Packit Service a31ea6
    const unsigned char* outend;
Packit Service a31ea6
    const unsigned char* outstart = out;
Packit Service a31ea6
    const unsigned char* instart = in;
Packit Service a31ea6
    const unsigned char* inend;
Packit Service a31ea6
    unsigned int c, d;
Packit Service a31ea6
    int trailing;
Packit Service a31ea6
Packit Service a31ea6
    if ((out == NULL) || (outlen == NULL) || (inlen == NULL)) return(-1);
Packit Service a31ea6
    if (in == NULL) {
Packit Service a31ea6
        /*
Packit Service a31ea6
	 * initialization nothing to do
Packit Service a31ea6
	 */
Packit Service a31ea6
	*outlen = 0;
Packit Service a31ea6
	*inlen = 0;
Packit Service a31ea6
	return(0);
Packit Service a31ea6
    }
Packit Service a31ea6
    inend = in + (*inlen);
Packit Service a31ea6
    outend = out + (*outlen);
Packit Service a31ea6
    while (in < inend) {
Packit Service a31ea6
	d = *in++;
Packit Service a31ea6
	if      (d < 0x80)  { c= d; trailing= 0; }
Packit Service a31ea6
	else if (d < 0xC0) {
Packit Service a31ea6
	    /* trailing byte in leading position */
Packit Service a31ea6
	    *outlen = out - outstart;
Packit Service a31ea6
	    *inlen = processed - instart;
Packit Service a31ea6
	    return(-2);
Packit Service a31ea6
        } else if (d < 0xE0)  { c= d & 0x1F; trailing= 1; }
Packit Service a31ea6
        else if (d < 0xF0)  { c= d & 0x0F; trailing= 2; }
Packit Service a31ea6
        else if (d < 0xF8)  { c= d & 0x07; trailing= 3; }
Packit Service a31ea6
	else {
Packit Service a31ea6
	    /* no chance for this in IsoLat1 */
Packit Service a31ea6
	    *outlen = out - outstart;
Packit Service a31ea6
	    *inlen = processed - instart;
Packit Service a31ea6
	    return(-2);
Packit Service a31ea6
	}
Packit Service a31ea6
Packit Service a31ea6
	if (inend - in < trailing) {
Packit Service a31ea6
	    break;
Packit Service a31ea6
	}
Packit Service a31ea6
Packit Service a31ea6
	for ( ; trailing; trailing--) {
Packit Service a31ea6
	    if (in >= inend)
Packit Service a31ea6
		break;
Packit Service a31ea6
	    if (((d= *in++) & 0xC0) != 0x80) {
Packit Service a31ea6
		*outlen = out - outstart;
Packit Service a31ea6
		*inlen = processed - instart;
Packit Service a31ea6
		return(-2);
Packit Service a31ea6
	    }
Packit Service a31ea6
	    c <<= 6;
Packit Service a31ea6
	    c |= d & 0x3F;
Packit Service a31ea6
	}
Packit Service a31ea6
Packit Service a31ea6
	/* assertion: c is a single UTF-4 value */
Packit Service a31ea6
	if (c <= 0xFF) {
Packit Service a31ea6
	    if (out >= outend)
Packit Service a31ea6
		break;
Packit Service a31ea6
	    *out++ = c;
Packit Service a31ea6
	} else {
Packit Service a31ea6
	    /* no chance for this in IsoLat1 */
Packit Service a31ea6
	    *outlen = out - outstart;
Packit Service a31ea6
	    *inlen = processed - instart;
Packit Service a31ea6
	    return(-2);
Packit Service a31ea6
	}
Packit Service a31ea6
	processed = in;
Packit Service a31ea6
    }
Packit Service a31ea6
    *outlen = out - outstart;
Packit Service a31ea6
    *inlen = processed - instart;
Packit Service a31ea6
    return(*outlen);
Packit Service a31ea6
}
Packit Service a31ea6
#endif /* LIBXML_OUTPUT_ENABLED */
Packit Service a31ea6
Packit Service a31ea6
/**
Packit Service a31ea6
 * UTF16LEToUTF8:
Packit Service a31ea6
 * @out:  a pointer to an array of bytes to store the result
Packit Service a31ea6
 * @outlen:  the length of @out
Packit Service a31ea6
 * @inb:  a pointer to an array of UTF-16LE passwd as a byte array
Packit Service a31ea6
 * @inlenb:  the length of @in in UTF-16LE chars
Packit Service a31ea6
 *
Packit Service a31ea6
 * Take a block of UTF-16LE ushorts in and try to convert it to an UTF-8
Packit Service a31ea6
 * block of chars out. This function assumes the endian property
Packit Service a31ea6
 * is the same between the native type of this machine and the
Packit Service a31ea6
 * inputed one.
Packit Service a31ea6
 *
Packit Service a31ea6
 * Returns the number of bytes written, or -1 if lack of space, or -2
Packit Service a31ea6
 *     if the transcoding fails (if *in is not a valid utf16 string)
Packit Service a31ea6
 *     The value of *inlen after return is the number of octets consumed
Packit Service a31ea6
 *     if the return value is positive, else unpredictable.
Packit Service a31ea6
 */
Packit Service a31ea6
static int
Packit Service a31ea6
UTF16LEToUTF8(unsigned char* out, int *outlen,
Packit Service a31ea6
            const unsigned char* inb, int *inlenb)
Packit Service a31ea6
{
Packit Service a31ea6
    unsigned char* outstart = out;
Packit Service a31ea6
    const unsigned char* processed = inb;
Packit Service a31ea6
    unsigned char* outend = out + *outlen;
Packit Service a31ea6
    unsigned short* in = (unsigned short*) inb;
Packit Service a31ea6
    unsigned short* inend;
Packit Service a31ea6
    unsigned int c, d, inlen;
Packit Service a31ea6
    unsigned char *tmp;
Packit Service a31ea6
    int bits;
Packit Service a31ea6
Packit Service a31ea6
    if ((*inlenb % 2) == 1)
Packit Service a31ea6
        (*inlenb)--;
Packit Service a31ea6
    inlen = *inlenb / 2;
Packit Service a31ea6
    inend = in + inlen;
Packit Service a31ea6
    while ((in < inend) && (out - outstart + 5 < *outlen)) {
Packit Service a31ea6
        if (xmlLittleEndian) {
Packit Service a31ea6
	    c= *in++;
Packit Service a31ea6
	} else {
Packit Service a31ea6
	    tmp = (unsigned char *) in;
Packit Service a31ea6
	    c = *tmp++;
Packit Service a31ea6
	    c = c | (((unsigned int)*tmp) << 8);
Packit Service a31ea6
	    in++;
Packit Service a31ea6
	}
Packit Service a31ea6
        if ((c & 0xFC00) == 0xD800) {    /* surrogates */
Packit Service a31ea6
	    if (in >= inend) {           /* (in > inend) shouldn't happens */
Packit Service a31ea6
		break;
Packit Service a31ea6
	    }
Packit Service a31ea6
	    if (xmlLittleEndian) {
Packit Service a31ea6
		d = *in++;
Packit Service a31ea6
	    } else {
Packit Service a31ea6
		tmp = (unsigned char *) in;
Packit Service a31ea6
		d = *tmp++;
Packit Service a31ea6
		d = d | (((unsigned int)*tmp) << 8);
Packit Service a31ea6
		in++;
Packit Service a31ea6
	    }
Packit Service a31ea6
            if ((d & 0xFC00) == 0xDC00) {
Packit Service a31ea6
                c &= 0x03FF;
Packit Service a31ea6
                c <<= 10;
Packit Service a31ea6
                c |= d & 0x03FF;
Packit Service a31ea6
                c += 0x10000;
Packit Service a31ea6
            }
Packit Service a31ea6
            else {
Packit Service a31ea6
		*outlen = out - outstart;
Packit Service a31ea6
		*inlenb = processed - inb;
Packit Service a31ea6
	        return(-2);
Packit Service a31ea6
	    }
Packit Service a31ea6
        }
Packit Service a31ea6
Packit Service a31ea6
	/* assertion: c is a single UTF-4 value */
Packit Service a31ea6
        if (out >= outend)
Packit Service a31ea6
	    break;
Packit Service a31ea6
        if      (c <    0x80) {  *out++=  c;                bits= -6; }
Packit Service a31ea6
        else if (c <   0x800) {  *out++= ((c >>  6) & 0x1F) | 0xC0;  bits=  0; }
Packit Service a31ea6
        else if (c < 0x10000) {  *out++= ((c >> 12) & 0x0F) | 0xE0;  bits=  6; }
Packit Service a31ea6
        else                  {  *out++= ((c >> 18) & 0x07) | 0xF0;  bits= 12; }
Packit Service a31ea6
Packit Service a31ea6
        for ( ; bits >= 0; bits-= 6) {
Packit Service a31ea6
            if (out >= outend)
Packit Service a31ea6
	        break;
Packit Service a31ea6
            *out++= ((c >> bits) & 0x3F) | 0x80;
Packit Service a31ea6
        }
Packit Service a31ea6
	processed = (const unsigned char*) in;
Packit Service a31ea6
    }
Packit Service a31ea6
    *outlen = out - outstart;
Packit Service a31ea6
    *inlenb = processed - inb;
Packit Service a31ea6
    return(*outlen);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
#ifdef LIBXML_OUTPUT_ENABLED
Packit Service a31ea6
/**
Packit Service a31ea6
 * UTF8ToUTF16LE:
Packit Service a31ea6
 * @outb:  a pointer to an array of bytes to store the result
Packit Service a31ea6
 * @outlen:  the length of @outb
Packit Service a31ea6
 * @in:  a pointer to an array of UTF-8 chars
Packit Service a31ea6
 * @inlen:  the length of @in
Packit Service a31ea6
 *
Packit Service a31ea6
 * Take a block of UTF-8 chars in and try to convert it to an UTF-16LE
Packit Service a31ea6
 * block of chars out.
Packit Service a31ea6
 *
Packit Service a31ea6
 * Returns the number of bytes written, or -1 if lack of space, or -2
Packit Service a31ea6
 *     if the transcoding failed.
Packit Service a31ea6
 */
Packit Service a31ea6
static int
Packit Service a31ea6
UTF8ToUTF16LE(unsigned char* outb, int *outlen,
Packit Service a31ea6
            const unsigned char* in, int *inlen)
Packit Service a31ea6
{
Packit Service a31ea6
    unsigned short* out = (unsigned short*) outb;
Packit Service a31ea6
    const unsigned char* processed = in;
Packit Service a31ea6
    const unsigned char *const instart = in;
Packit Service a31ea6
    unsigned short* outstart= out;
Packit Service a31ea6
    unsigned short* outend;
Packit Service a31ea6
    const unsigned char* inend;
Packit Service a31ea6
    unsigned int c, d;
Packit Service a31ea6
    int trailing;
Packit Service a31ea6
    unsigned char *tmp;
Packit Service a31ea6
    unsigned short tmp1, tmp2;
Packit Service a31ea6
Packit Service a31ea6
    /* UTF16LE encoding has no BOM */
Packit Service a31ea6
    if ((out == NULL) || (outlen == NULL) || (inlen == NULL)) return(-1);
Packit Service a31ea6
    if (in == NULL) {
Packit Service a31ea6
	*outlen = 0;
Packit Service a31ea6
	*inlen = 0;
Packit Service a31ea6
	return(0);
Packit Service a31ea6
    }
Packit Service a31ea6
    inend= in + *inlen;
Packit Service a31ea6
    outend = out + (*outlen / 2);
Packit Service a31ea6
    while (in < inend) {
Packit Service a31ea6
      d= *in++;
Packit Service a31ea6
      if      (d < 0x80)  { c= d; trailing= 0; }
Packit Service a31ea6
      else if (d < 0xC0) {
Packit Service a31ea6
          /* trailing byte in leading position */
Packit Service a31ea6
	  *outlen = (out - outstart) * 2;
Packit Service a31ea6
	  *inlen = processed - instart;
Packit Service a31ea6
	  return(-2);
Packit Service a31ea6
      } else if (d < 0xE0)  { c= d & 0x1F; trailing= 1; }
Packit Service a31ea6
      else if (d < 0xF0)  { c= d & 0x0F; trailing= 2; }
Packit Service a31ea6
      else if (d < 0xF8)  { c= d & 0x07; trailing= 3; }
Packit Service a31ea6
      else {
Packit Service a31ea6
	/* no chance for this in UTF-16 */
Packit Service a31ea6
	*outlen = (out - outstart) * 2;
Packit Service a31ea6
	*inlen = processed - instart;
Packit Service a31ea6
	return(-2);
Packit Service a31ea6
      }
Packit Service a31ea6
Packit Service a31ea6
      if (inend - in < trailing) {
Packit Service a31ea6
          break;
Packit Service a31ea6
      }
Packit Service a31ea6
Packit Service a31ea6
      for ( ; trailing; trailing--) {
Packit Service a31ea6
          if ((in >= inend) || (((d= *in++) & 0xC0) != 0x80))
Packit Service a31ea6
	      break;
Packit Service a31ea6
          c <<= 6;
Packit Service a31ea6
          c |= d & 0x3F;
Packit Service a31ea6
      }
Packit Service a31ea6
Packit Service a31ea6
      /* assertion: c is a single UTF-4 value */
Packit Service a31ea6
        if (c < 0x10000) {
Packit Service a31ea6
            if (out >= outend)
Packit Service a31ea6
	        break;
Packit Service a31ea6
	    if (xmlLittleEndian) {
Packit Service a31ea6
		*out++ = c;
Packit Service a31ea6
	    } else {
Packit Service a31ea6
		tmp = (unsigned char *) out;
Packit Service a31ea6
		*tmp = c ;
Packit Service a31ea6
		*(tmp + 1) = c >> 8 ;
Packit Service a31ea6
		out++;
Packit Service a31ea6
	    }
Packit Service a31ea6
        }
Packit Service a31ea6
        else if (c < 0x110000) {
Packit Service a31ea6
            if (out+1 >= outend)
Packit Service a31ea6
	        break;
Packit Service a31ea6
            c -= 0x10000;
Packit Service a31ea6
	    if (xmlLittleEndian) {
Packit Service a31ea6
		*out++ = 0xD800 | (c >> 10);
Packit Service a31ea6
		*out++ = 0xDC00 | (c & 0x03FF);
Packit Service a31ea6
	    } else {
Packit Service a31ea6
		tmp1 = 0xD800 | (c >> 10);
Packit Service a31ea6
		tmp = (unsigned char *) out;
Packit Service a31ea6
		*tmp = (unsigned char) tmp1;
Packit Service a31ea6
		*(tmp + 1) = tmp1 >> 8;
Packit Service a31ea6
		out++;
Packit Service a31ea6
Packit Service a31ea6
		tmp2 = 0xDC00 | (c & 0x03FF);
Packit Service a31ea6
		tmp = (unsigned char *) out;
Packit Service a31ea6
		*tmp  = (unsigned char) tmp2;
Packit Service a31ea6
		*(tmp + 1) = tmp2 >> 8;
Packit Service a31ea6
		out++;
Packit Service a31ea6
	    }
Packit Service a31ea6
        }
Packit Service a31ea6
        else
Packit Service a31ea6
	    break;
Packit Service a31ea6
	processed = in;
Packit Service a31ea6
    }
Packit Service a31ea6
    *outlen = (out - outstart) * 2;
Packit Service a31ea6
    *inlen = processed - instart;
Packit Service a31ea6
    return(*outlen);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
/**
Packit Service a31ea6
 * UTF8ToUTF16:
Packit Service a31ea6
 * @outb:  a pointer to an array of bytes to store the result
Packit Service a31ea6
 * @outlen:  the length of @outb
Packit Service a31ea6
 * @in:  a pointer to an array of UTF-8 chars
Packit Service a31ea6
 * @inlen:  the length of @in
Packit Service a31ea6
 *
Packit Service a31ea6
 * Take a block of UTF-8 chars in and try to convert it to an UTF-16
Packit Service a31ea6
 * block of chars out.
Packit Service a31ea6
 *
Packit Service a31ea6
 * Returns the number of bytes written, or -1 if lack of space, or -2
Packit Service a31ea6
 *     if the transcoding failed.
Packit Service a31ea6
 */
Packit Service a31ea6
static int
Packit Service a31ea6
UTF8ToUTF16(unsigned char* outb, int *outlen,
Packit Service a31ea6
            const unsigned char* in, int *inlen)
Packit Service a31ea6
{
Packit Service a31ea6
    if (in == NULL) {
Packit Service a31ea6
	/*
Packit Service a31ea6
	 * initialization, add the Byte Order Mark for UTF-16LE
Packit Service a31ea6
	 */
Packit Service a31ea6
        if (*outlen >= 2) {
Packit Service a31ea6
	    outb[0] = 0xFF;
Packit Service a31ea6
	    outb[1] = 0xFE;
Packit Service a31ea6
	    *outlen = 2;
Packit Service a31ea6
	    *inlen = 0;
Packit Service a31ea6
#ifdef DEBUG_ENCODING
Packit Service a31ea6
            xmlGenericError(xmlGenericErrorContext,
Packit Service a31ea6
		    "Added FFFE Byte Order Mark\n");
Packit Service a31ea6
#endif
Packit Service a31ea6
	    return(2);
Packit Service a31ea6
	}
Packit Service a31ea6
	*outlen = 0;
Packit Service a31ea6
	*inlen = 0;
Packit Service a31ea6
	return(0);
Packit Service a31ea6
    }
Packit Service a31ea6
    return (UTF8ToUTF16LE(outb, outlen, in, inlen));
Packit Service a31ea6
}
Packit Service a31ea6
#endif /* LIBXML_OUTPUT_ENABLED */
Packit Service a31ea6
Packit Service a31ea6
/**
Packit Service a31ea6
 * UTF16BEToUTF8:
Packit Service a31ea6
 * @out:  a pointer to an array of bytes to store the result
Packit Service a31ea6
 * @outlen:  the length of @out
Packit Service a31ea6
 * @inb:  a pointer to an array of UTF-16 passed as a byte array
Packit Service a31ea6
 * @inlenb:  the length of @in in UTF-16 chars
Packit Service a31ea6
 *
Packit Service a31ea6
 * Take a block of UTF-16 ushorts in and try to convert it to an UTF-8
Packit Service a31ea6
 * block of chars out. This function assumes the endian property
Packit Service a31ea6
 * is the same between the native type of this machine and the
Packit Service a31ea6
 * inputed one.
Packit Service a31ea6
 *
Packit Service a31ea6
 * Returns the number of bytes written, or -1 if lack of space, or -2
Packit Service a31ea6
 *     if the transcoding fails (if *in is not a valid utf16 string)
Packit Service a31ea6
 * The value of *inlen after return is the number of octets consumed
Packit Service a31ea6
 *     if the return value is positive, else unpredictable.
Packit Service a31ea6
 */
Packit Service a31ea6
static int
Packit Service a31ea6
UTF16BEToUTF8(unsigned char* out, int *outlen,
Packit Service a31ea6
            const unsigned char* inb, int *inlenb)
Packit Service a31ea6
{
Packit Service a31ea6
    unsigned char* outstart = out;
Packit Service a31ea6
    const unsigned char* processed = inb;
Packit Service a31ea6
    unsigned char* outend = out + *outlen;
Packit Service a31ea6
    unsigned short* in = (unsigned short*) inb;
Packit Service a31ea6
    unsigned short* inend;
Packit Service a31ea6
    unsigned int c, d, inlen;
Packit Service a31ea6
    unsigned char *tmp;
Packit Service a31ea6
    int bits;
Packit Service a31ea6
Packit Service a31ea6
    if ((*inlenb % 2) == 1)
Packit Service a31ea6
        (*inlenb)--;
Packit Service a31ea6
    inlen = *inlenb / 2;
Packit Service a31ea6
    inend= in + inlen;
Packit Service a31ea6
    while (in < inend) {
Packit Service a31ea6
	if (xmlLittleEndian) {
Packit Service a31ea6
	    tmp = (unsigned char *) in;
Packit Service a31ea6
	    c = *tmp++;
Packit Service a31ea6
	    c = c << 8;
Packit Service a31ea6
	    c = c | (unsigned int) *tmp;
Packit Service a31ea6
	    in++;
Packit Service a31ea6
	} else {
Packit Service a31ea6
	    c= *in++;
Packit Service a31ea6
	}
Packit Service a31ea6
        if ((c & 0xFC00) == 0xD800) {    /* surrogates */
Packit Service a31ea6
	    if (in >= inend) {           /* (in > inend) shouldn't happens */
Packit Service a31ea6
		*outlen = out - outstart;
Packit Service a31ea6
		*inlenb = processed - inb;
Packit Service a31ea6
	        return(-2);
Packit Service a31ea6
	    }
Packit Service a31ea6
	    if (xmlLittleEndian) {
Packit Service a31ea6
		tmp = (unsigned char *) in;
Packit Service a31ea6
		d = *tmp++;
Packit Service a31ea6
		d = d << 8;
Packit Service a31ea6
		d = d | (unsigned int) *tmp;
Packit Service a31ea6
		in++;
Packit Service a31ea6
	    } else {
Packit Service a31ea6
		d= *in++;
Packit Service a31ea6
	    }
Packit Service a31ea6
            if ((d & 0xFC00) == 0xDC00) {
Packit Service a31ea6
                c &= 0x03FF;
Packit Service a31ea6
                c <<= 10;
Packit Service a31ea6
                c |= d & 0x03FF;
Packit Service a31ea6
                c += 0x10000;
Packit Service a31ea6
            }
Packit Service a31ea6
            else {
Packit Service a31ea6
		*outlen = out - outstart;
Packit Service a31ea6
		*inlenb = processed - inb;
Packit Service a31ea6
	        return(-2);
Packit Service a31ea6
	    }
Packit Service a31ea6
        }
Packit Service a31ea6
Packit Service a31ea6
	/* assertion: c is a single UTF-4 value */
Packit Service a31ea6
        if (out >= outend)
Packit Service a31ea6
	    break;
Packit Service a31ea6
        if      (c <    0x80) {  *out++=  c;                bits= -6; }
Packit Service a31ea6
        else if (c <   0x800) {  *out++= ((c >>  6) & 0x1F) | 0xC0;  bits=  0; }
Packit Service a31ea6
        else if (c < 0x10000) {  *out++= ((c >> 12) & 0x0F) | 0xE0;  bits=  6; }
Packit Service a31ea6
        else                  {  *out++= ((c >> 18) & 0x07) | 0xF0;  bits= 12; }
Packit Service a31ea6
Packit Service a31ea6
        for ( ; bits >= 0; bits-= 6) {
Packit Service a31ea6
            if (out >= outend)
Packit Service a31ea6
	        break;
Packit Service a31ea6
            *out++= ((c >> bits) & 0x3F) | 0x80;
Packit Service a31ea6
        }
Packit Service a31ea6
	processed = (const unsigned char*) in;
Packit Service a31ea6
    }
Packit Service a31ea6
    *outlen = out - outstart;
Packit Service a31ea6
    *inlenb = processed - inb;
Packit Service a31ea6
    return(*outlen);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
#ifdef LIBXML_OUTPUT_ENABLED
Packit Service a31ea6
/**
Packit Service a31ea6
 * UTF8ToUTF16BE:
Packit Service a31ea6
 * @outb:  a pointer to an array of bytes to store the result
Packit Service a31ea6
 * @outlen:  the length of @outb
Packit Service a31ea6
 * @in:  a pointer to an array of UTF-8 chars
Packit Service a31ea6
 * @inlen:  the length of @in
Packit Service a31ea6
 *
Packit Service a31ea6
 * Take a block of UTF-8 chars in and try to convert it to an UTF-16BE
Packit Service a31ea6
 * block of chars out.
Packit Service a31ea6
 *
Packit Service a31ea6
 * Returns the number of byte written, or -1 by lack of space, or -2
Packit Service a31ea6
 *     if the transcoding failed.
Packit Service a31ea6
 */
Packit Service a31ea6
static int
Packit Service a31ea6
UTF8ToUTF16BE(unsigned char* outb, int *outlen,
Packit Service a31ea6
            const unsigned char* in, int *inlen)
Packit Service a31ea6
{
Packit Service a31ea6
    unsigned short* out = (unsigned short*) outb;
Packit Service a31ea6
    const unsigned char* processed = in;
Packit Service a31ea6
    const unsigned char *const instart = in;
Packit Service a31ea6
    unsigned short* outstart= out;
Packit Service a31ea6
    unsigned short* outend;
Packit Service a31ea6
    const unsigned char* inend;
Packit Service a31ea6
    unsigned int c, d;
Packit Service a31ea6
    int trailing;
Packit Service a31ea6
    unsigned char *tmp;
Packit Service a31ea6
    unsigned short tmp1, tmp2;
Packit Service a31ea6
Packit Service a31ea6
    /* UTF-16BE has no BOM */
Packit Service a31ea6
    if ((outb == NULL) || (outlen == NULL) || (inlen == NULL)) return(-1);
Packit Service a31ea6
    if (in == NULL) {
Packit Service a31ea6
	*outlen = 0;
Packit Service a31ea6
	*inlen = 0;
Packit Service a31ea6
	return(0);
Packit Service a31ea6
    }
Packit Service a31ea6
    inend= in + *inlen;
Packit Service a31ea6
    outend = out + (*outlen / 2);
Packit Service a31ea6
    while (in < inend) {
Packit Service a31ea6
      d= *in++;
Packit Service a31ea6
      if      (d < 0x80)  { c= d; trailing= 0; }
Packit Service a31ea6
      else if (d < 0xC0)  {
Packit Service a31ea6
          /* trailing byte in leading position */
Packit Service a31ea6
	  *outlen = out - outstart;
Packit Service a31ea6
	  *inlen = processed - instart;
Packit Service a31ea6
	  return(-2);
Packit Service a31ea6
      } else if (d < 0xE0)  { c= d & 0x1F; trailing= 1; }
Packit Service a31ea6
      else if (d < 0xF0)  { c= d & 0x0F; trailing= 2; }
Packit Service a31ea6
      else if (d < 0xF8)  { c= d & 0x07; trailing= 3; }
Packit Service a31ea6
      else {
Packit Service a31ea6
          /* no chance for this in UTF-16 */
Packit Service a31ea6
	  *outlen = out - outstart;
Packit Service a31ea6
	  *inlen = processed - instart;
Packit Service a31ea6
	  return(-2);
Packit Service a31ea6
      }
Packit Service a31ea6
Packit Service a31ea6
      if (inend - in < trailing) {
Packit Service a31ea6
          break;
Packit Service a31ea6
      }
Packit Service a31ea6
Packit Service a31ea6
      for ( ; trailing; trailing--) {
Packit Service a31ea6
          if ((in >= inend) || (((d= *in++) & 0xC0) != 0x80))  break;
Packit Service a31ea6
          c <<= 6;
Packit Service a31ea6
          c |= d & 0x3F;
Packit Service a31ea6
      }
Packit Service a31ea6
Packit Service a31ea6
      /* assertion: c is a single UTF-4 value */
Packit Service a31ea6
        if (c < 0x10000) {
Packit Service a31ea6
            if (out >= outend)  break;
Packit Service a31ea6
	    if (xmlLittleEndian) {
Packit Service a31ea6
		tmp = (unsigned char *) out;
Packit Service a31ea6
		*tmp = c >> 8;
Packit Service a31ea6
		*(tmp + 1) = c;
Packit Service a31ea6
		out++;
Packit Service a31ea6
	    } else {
Packit Service a31ea6
		*out++ = c;
Packit Service a31ea6
	    }
Packit Service a31ea6
        }
Packit Service a31ea6
        else if (c < 0x110000) {
Packit Service a31ea6
            if (out+1 >= outend)  break;
Packit Service a31ea6
            c -= 0x10000;
Packit Service a31ea6
	    if (xmlLittleEndian) {
Packit Service a31ea6
		tmp1 = 0xD800 | (c >> 10);
Packit Service a31ea6
		tmp = (unsigned char *) out;
Packit Service a31ea6
		*tmp = tmp1 >> 8;
Packit Service a31ea6
		*(tmp + 1) = (unsigned char) tmp1;
Packit Service a31ea6
		out++;
Packit Service a31ea6
Packit Service a31ea6
		tmp2 = 0xDC00 | (c & 0x03FF);
Packit Service a31ea6
		tmp = (unsigned char *) out;
Packit Service a31ea6
		*tmp = tmp2 >> 8;
Packit Service a31ea6
		*(tmp + 1) = (unsigned char) tmp2;
Packit Service a31ea6
		out++;
Packit Service a31ea6
	    } else {
Packit Service a31ea6
		*out++ = 0xD800 | (c >> 10);
Packit Service a31ea6
		*out++ = 0xDC00 | (c & 0x03FF);
Packit Service a31ea6
	    }
Packit Service a31ea6
        }
Packit Service a31ea6
        else
Packit Service a31ea6
	    break;
Packit Service a31ea6
	processed = in;
Packit Service a31ea6
    }
Packit Service a31ea6
    *outlen = (out - outstart) * 2;
Packit Service a31ea6
    *inlen = processed - instart;
Packit Service a31ea6
    return(*outlen);
Packit Service a31ea6
}
Packit Service a31ea6
#endif /* LIBXML_OUTPUT_ENABLED */
Packit Service a31ea6
Packit Service a31ea6
/************************************************************************
Packit Service a31ea6
 *									*
Packit Service a31ea6
 *		Generic encoding handling routines			*
Packit Service a31ea6
 *									*
Packit Service a31ea6
 ************************************************************************/
Packit Service a31ea6
Packit Service a31ea6
/**
Packit Service a31ea6
 * xmlDetectCharEncoding:
Packit Service a31ea6
 * @in:  a pointer to the first bytes of the XML entity, must be at least
Packit Service a31ea6
 *       2 bytes long (at least 4 if encoding is UTF4 variant).
Packit Service a31ea6
 * @len:  pointer to the length of the buffer
Packit Service a31ea6
 *
Packit Service a31ea6
 * Guess the encoding of the entity using the first bytes of the entity content
Packit Service a31ea6
 * according to the non-normative appendix F of the XML-1.0 recommendation.
Packit Service a31ea6
 *
Packit Service a31ea6
 * Returns one of the XML_CHAR_ENCODING_... values.
Packit Service a31ea6
 */
Packit Service a31ea6
xmlCharEncoding
Packit Service a31ea6
xmlDetectCharEncoding(const unsigned char* in, int len)
Packit Service a31ea6
{
Packit Service a31ea6
    if (in == NULL)
Packit Service a31ea6
        return(XML_CHAR_ENCODING_NONE);
Packit Service a31ea6
    if (len >= 4) {
Packit Service a31ea6
	if ((in[0] == 0x00) && (in[1] == 0x00) &&
Packit Service a31ea6
	    (in[2] == 0x00) && (in[3] == 0x3C))
Packit Service a31ea6
	    return(XML_CHAR_ENCODING_UCS4BE);
Packit Service a31ea6
	if ((in[0] == 0x3C) && (in[1] == 0x00) &&
Packit Service a31ea6
	    (in[2] == 0x00) && (in[3] == 0x00))
Packit Service a31ea6
	    return(XML_CHAR_ENCODING_UCS4LE);
Packit Service a31ea6
	if ((in[0] == 0x00) && (in[1] == 0x00) &&
Packit Service a31ea6
	    (in[2] == 0x3C) && (in[3] == 0x00))
Packit Service a31ea6
	    return(XML_CHAR_ENCODING_UCS4_2143);
Packit Service a31ea6
	if ((in[0] == 0x00) && (in[1] == 0x3C) &&
Packit Service a31ea6
	    (in[2] == 0x00) && (in[3] == 0x00))
Packit Service a31ea6
	    return(XML_CHAR_ENCODING_UCS4_3412);
Packit Service a31ea6
	if ((in[0] == 0x4C) && (in[1] == 0x6F) &&
Packit Service a31ea6
	    (in[2] == 0xA7) && (in[3] == 0x94))
Packit Service a31ea6
	    return(XML_CHAR_ENCODING_EBCDIC);
Packit Service a31ea6
	if ((in[0] == 0x3C) && (in[1] == 0x3F) &&
Packit Service a31ea6
	    (in[2] == 0x78) && (in[3] == 0x6D))
Packit Service a31ea6
	    return(XML_CHAR_ENCODING_UTF8);
Packit Service a31ea6
	/*
Packit Service a31ea6
	 * Although not part of the recommendation, we also
Packit Service a31ea6
	 * attempt an "auto-recognition" of UTF-16LE and
Packit Service a31ea6
	 * UTF-16BE encodings.
Packit Service a31ea6
	 */
Packit Service a31ea6
	if ((in[0] == 0x3C) && (in[1] == 0x00) &&
Packit Service a31ea6
	    (in[2] == 0x3F) && (in[3] == 0x00))
Packit Service a31ea6
	    return(XML_CHAR_ENCODING_UTF16LE);
Packit Service a31ea6
	if ((in[0] == 0x00) && (in[1] == 0x3C) &&
Packit Service a31ea6
	    (in[2] == 0x00) && (in[3] == 0x3F))
Packit Service a31ea6
	    return(XML_CHAR_ENCODING_UTF16BE);
Packit Service a31ea6
    }
Packit Service a31ea6
    if (len >= 3) {
Packit Service a31ea6
	/*
Packit Service a31ea6
	 * Errata on XML-1.0 June 20 2001
Packit Service a31ea6
	 * We now allow an UTF8 encoded BOM
Packit Service a31ea6
	 */
Packit Service a31ea6
	if ((in[0] == 0xEF) && (in[1] == 0xBB) &&
Packit Service a31ea6
	    (in[2] == 0xBF))
Packit Service a31ea6
	    return(XML_CHAR_ENCODING_UTF8);
Packit Service a31ea6
    }
Packit Service a31ea6
    /* For UTF-16 we can recognize by the BOM */
Packit Service a31ea6
    if (len >= 2) {
Packit Service a31ea6
	if ((in[0] == 0xFE) && (in[1] == 0xFF))
Packit Service a31ea6
	    return(XML_CHAR_ENCODING_UTF16BE);
Packit Service a31ea6
	if ((in[0] == 0xFF) && (in[1] == 0xFE))
Packit Service a31ea6
	    return(XML_CHAR_ENCODING_UTF16LE);
Packit Service a31ea6
    }
Packit Service a31ea6
    return(XML_CHAR_ENCODING_NONE);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
/**
Packit Service a31ea6
 * xmlCleanupEncodingAliases:
Packit Service a31ea6
 *
Packit Service a31ea6
 * Unregisters all aliases
Packit Service a31ea6
 */
Packit Service a31ea6
void
Packit Service a31ea6
xmlCleanupEncodingAliases(void) {
Packit Service a31ea6
    int i;
Packit Service a31ea6
Packit Service a31ea6
    if (xmlCharEncodingAliases == NULL)
Packit Service a31ea6
	return;
Packit Service a31ea6
Packit Service a31ea6
    for (i = 0;i < xmlCharEncodingAliasesNb;i++) {
Packit Service a31ea6
	if (xmlCharEncodingAliases[i].name != NULL)
Packit Service a31ea6
	    xmlFree((char *) xmlCharEncodingAliases[i].name);
Packit Service a31ea6
	if (xmlCharEncodingAliases[i].alias != NULL)
Packit Service a31ea6
	    xmlFree((char *) xmlCharEncodingAliases[i].alias);
Packit Service a31ea6
    }
Packit Service a31ea6
    xmlCharEncodingAliasesNb = 0;
Packit Service a31ea6
    xmlCharEncodingAliasesMax = 0;
Packit Service a31ea6
    xmlFree(xmlCharEncodingAliases);
Packit Service a31ea6
    xmlCharEncodingAliases = NULL;
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
/**
Packit Service a31ea6
 * xmlGetEncodingAlias:
Packit Service a31ea6
 * @alias:  the alias name as parsed, in UTF-8 format (ASCII actually)
Packit Service a31ea6
 *
Packit Service a31ea6
 * Lookup an encoding name for the given alias.
Packit Service a31ea6
 *
Packit Service a31ea6
 * Returns NULL if not found, otherwise the original name
Packit Service a31ea6
 */
Packit Service a31ea6
const char *
Packit Service a31ea6
xmlGetEncodingAlias(const char *alias) {
Packit Service a31ea6
    int i;
Packit Service a31ea6
    char upper[100];
Packit Service a31ea6
Packit Service a31ea6
    if (alias == NULL)
Packit Service a31ea6
	return(NULL);
Packit Service a31ea6
Packit Service a31ea6
    if (xmlCharEncodingAliases == NULL)
Packit Service a31ea6
	return(NULL);
Packit Service a31ea6
Packit Service a31ea6
    for (i = 0;i < 99;i++) {
Packit Service a31ea6
        upper[i] = toupper(alias[i]);
Packit Service a31ea6
	if (upper[i] == 0) break;
Packit Service a31ea6
    }
Packit Service a31ea6
    upper[i] = 0;
Packit Service a31ea6
Packit Service a31ea6
    /*
Packit Service a31ea6
     * Walk down the list looking for a definition of the alias
Packit Service a31ea6
     */
Packit Service a31ea6
    for (i = 0;i < xmlCharEncodingAliasesNb;i++) {
Packit Service a31ea6
	if (!strcmp(xmlCharEncodingAliases[i].alias, upper)) {
Packit Service a31ea6
	    return(xmlCharEncodingAliases[i].name);
Packit Service a31ea6
	}
Packit Service a31ea6
    }
Packit Service a31ea6
    return(NULL);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
/**
Packit Service a31ea6
 * xmlAddEncodingAlias:
Packit Service a31ea6
 * @name:  the encoding name as parsed, in UTF-8 format (ASCII actually)
Packit Service a31ea6
 * @alias:  the alias name as parsed, in UTF-8 format (ASCII actually)
Packit Service a31ea6
 *
Packit Service a31ea6
 * Registers an alias @alias for an encoding named @name. Existing alias
Packit Service a31ea6
 * will be overwritten.
Packit Service a31ea6
 *
Packit Service a31ea6
 * Returns 0 in case of success, -1 in case of error
Packit Service a31ea6
 */
Packit Service a31ea6
int
Packit Service a31ea6
xmlAddEncodingAlias(const char *name, const char *alias) {
Packit Service a31ea6
    int i;
Packit Service a31ea6
    char upper[100];
Packit Service a31ea6
Packit Service a31ea6
    if ((name == NULL) || (alias == NULL))
Packit Service a31ea6
	return(-1);
Packit Service a31ea6
Packit Service a31ea6
    for (i = 0;i < 99;i++) {
Packit Service a31ea6
        upper[i] = toupper(alias[i]);
Packit Service a31ea6
	if (upper[i] == 0) break;
Packit Service a31ea6
    }
Packit Service a31ea6
    upper[i] = 0;
Packit Service a31ea6
Packit Service a31ea6
    if (xmlCharEncodingAliases == NULL) {
Packit Service a31ea6
	xmlCharEncodingAliasesNb = 0;
Packit Service a31ea6
	xmlCharEncodingAliasesMax = 20;
Packit Service a31ea6
	xmlCharEncodingAliases = (xmlCharEncodingAliasPtr)
Packit Service a31ea6
	      xmlMalloc(xmlCharEncodingAliasesMax * sizeof(xmlCharEncodingAlias));
Packit Service a31ea6
	if (xmlCharEncodingAliases == NULL)
Packit Service a31ea6
	    return(-1);
Packit Service a31ea6
    } else if (xmlCharEncodingAliasesNb >= xmlCharEncodingAliasesMax) {
Packit Service a31ea6
	xmlCharEncodingAliasesMax *= 2;
Packit Service a31ea6
	xmlCharEncodingAliases = (xmlCharEncodingAliasPtr)
Packit Service a31ea6
	      xmlRealloc(xmlCharEncodingAliases,
Packit Service a31ea6
		         xmlCharEncodingAliasesMax * sizeof(xmlCharEncodingAlias));
Packit Service a31ea6
    }
Packit Service a31ea6
    /*
Packit Service a31ea6
     * Walk down the list looking for a definition of the alias
Packit Service a31ea6
     */
Packit Service a31ea6
    for (i = 0;i < xmlCharEncodingAliasesNb;i++) {
Packit Service a31ea6
	if (!strcmp(xmlCharEncodingAliases[i].alias, upper)) {
Packit Service a31ea6
	    /*
Packit Service a31ea6
	     * Replace the definition.
Packit Service a31ea6
	     */
Packit Service a31ea6
	    xmlFree((char *) xmlCharEncodingAliases[i].name);
Packit Service a31ea6
	    xmlCharEncodingAliases[i].name = xmlMemStrdup(name);
Packit Service a31ea6
	    return(0);
Packit Service a31ea6
	}
Packit Service a31ea6
    }
Packit Service a31ea6
    /*
Packit Service a31ea6
     * Add the definition
Packit Service a31ea6
     */
Packit Service a31ea6
    xmlCharEncodingAliases[xmlCharEncodingAliasesNb].name = xmlMemStrdup(name);
Packit Service a31ea6
    xmlCharEncodingAliases[xmlCharEncodingAliasesNb].alias = xmlMemStrdup(upper);
Packit Service a31ea6
    xmlCharEncodingAliasesNb++;
Packit Service a31ea6
    return(0);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
/**
Packit Service a31ea6
 * xmlDelEncodingAlias:
Packit Service a31ea6
 * @alias:  the alias name as parsed, in UTF-8 format (ASCII actually)
Packit Service a31ea6
 *
Packit Service a31ea6
 * Unregisters an encoding alias @alias
Packit Service a31ea6
 *
Packit Service a31ea6
 * Returns 0 in case of success, -1 in case of error
Packit Service a31ea6
 */
Packit Service a31ea6
int
Packit Service a31ea6
xmlDelEncodingAlias(const char *alias) {
Packit Service a31ea6
    int i;
Packit Service a31ea6
Packit Service a31ea6
    if (alias == NULL)
Packit Service a31ea6
	return(-1);
Packit Service a31ea6
Packit Service a31ea6
    if (xmlCharEncodingAliases == NULL)
Packit Service a31ea6
	return(-1);
Packit Service a31ea6
    /*
Packit Service a31ea6
     * Walk down the list looking for a definition of the alias
Packit Service a31ea6
     */
Packit Service a31ea6
    for (i = 0;i < xmlCharEncodingAliasesNb;i++) {
Packit Service a31ea6
	if (!strcmp(xmlCharEncodingAliases[i].alias, alias)) {
Packit Service a31ea6
	    xmlFree((char *) xmlCharEncodingAliases[i].name);
Packit Service a31ea6
	    xmlFree((char *) xmlCharEncodingAliases[i].alias);
Packit Service a31ea6
	    xmlCharEncodingAliasesNb--;
Packit Service a31ea6
	    memmove(&xmlCharEncodingAliases[i], &xmlCharEncodingAliases[i + 1],
Packit Service a31ea6
		    sizeof(xmlCharEncodingAlias) * (xmlCharEncodingAliasesNb - i));
Packit Service a31ea6
	    return(0);
Packit Service a31ea6
	}
Packit Service a31ea6
    }
Packit Service a31ea6
    return(-1);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
/**
Packit Service a31ea6
 * xmlParseCharEncoding:
Packit Service a31ea6
 * @name:  the encoding name as parsed, in UTF-8 format (ASCII actually)
Packit Service a31ea6
 *
Packit Service a31ea6
 * Compare the string to the encoding schemes already known. Note
Packit Service a31ea6
 * that the comparison is case insensitive accordingly to the section
Packit Service a31ea6
 * [XML] 4.3.3 Character Encoding in Entities.
Packit Service a31ea6
 *
Packit Service a31ea6
 * Returns one of the XML_CHAR_ENCODING_... values or XML_CHAR_ENCODING_NONE
Packit Service a31ea6
 * if not recognized.
Packit Service a31ea6
 */
Packit Service a31ea6
xmlCharEncoding
Packit Service a31ea6
xmlParseCharEncoding(const char* name)
Packit Service a31ea6
{
Packit Service a31ea6
    const char *alias;
Packit Service a31ea6
    char upper[500];
Packit Service a31ea6
    int i;
Packit Service a31ea6
Packit Service a31ea6
    if (name == NULL)
Packit Service a31ea6
	return(XML_CHAR_ENCODING_NONE);
Packit Service a31ea6
Packit Service a31ea6
    /*
Packit Service a31ea6
     * Do the alias resolution
Packit Service a31ea6
     */
Packit Service a31ea6
    alias = xmlGetEncodingAlias(name);
Packit Service a31ea6
    if (alias != NULL)
Packit Service a31ea6
	name = alias;
Packit Service a31ea6
Packit Service a31ea6
    for (i = 0;i < 499;i++) {
Packit Service a31ea6
        upper[i] = toupper(name[i]);
Packit Service a31ea6
	if (upper[i] == 0) break;
Packit Service a31ea6
    }
Packit Service a31ea6
    upper[i] = 0;
Packit Service a31ea6
Packit Service a31ea6
    if (!strcmp(upper, "")) return(XML_CHAR_ENCODING_NONE);
Packit Service a31ea6
    if (!strcmp(upper, "UTF-8")) return(XML_CHAR_ENCODING_UTF8);
Packit Service a31ea6
    if (!strcmp(upper, "UTF8")) return(XML_CHAR_ENCODING_UTF8);
Packit Service a31ea6
Packit Service a31ea6
    /*
Packit Service a31ea6
     * NOTE: if we were able to parse this, the endianness of UTF16 is
Packit Service a31ea6
     *       already found and in use
Packit Service a31ea6
     */
Packit Service a31ea6
    if (!strcmp(upper, "UTF-16")) return(XML_CHAR_ENCODING_UTF16LE);
Packit Service a31ea6
    if (!strcmp(upper, "UTF16")) return(XML_CHAR_ENCODING_UTF16LE);
Packit Service a31ea6
Packit Service a31ea6
    if (!strcmp(upper, "ISO-10646-UCS-2")) return(XML_CHAR_ENCODING_UCS2);
Packit Service a31ea6
    if (!strcmp(upper, "UCS-2")) return(XML_CHAR_ENCODING_UCS2);
Packit Service a31ea6
    if (!strcmp(upper, "UCS2")) return(XML_CHAR_ENCODING_UCS2);
Packit Service a31ea6
Packit Service a31ea6
    /*
Packit Service a31ea6
     * NOTE: if we were able to parse this, the endianness of UCS4 is
Packit Service a31ea6
     *       already found and in use
Packit Service a31ea6
     */
Packit Service a31ea6
    if (!strcmp(upper, "ISO-10646-UCS-4")) return(XML_CHAR_ENCODING_UCS4LE);
Packit Service a31ea6
    if (!strcmp(upper, "UCS-4")) return(XML_CHAR_ENCODING_UCS4LE);
Packit Service a31ea6
    if (!strcmp(upper, "UCS4")) return(XML_CHAR_ENCODING_UCS4LE);
Packit Service a31ea6
Packit Service a31ea6
Packit Service a31ea6
    if (!strcmp(upper,  "ISO-8859-1")) return(XML_CHAR_ENCODING_8859_1);
Packit Service a31ea6
    if (!strcmp(upper,  "ISO-LATIN-1")) return(XML_CHAR_ENCODING_8859_1);
Packit Service a31ea6
    if (!strcmp(upper,  "ISO LATIN 1")) return(XML_CHAR_ENCODING_8859_1);
Packit Service a31ea6
Packit Service a31ea6
    if (!strcmp(upper,  "ISO-8859-2")) return(XML_CHAR_ENCODING_8859_2);
Packit Service a31ea6
    if (!strcmp(upper,  "ISO-LATIN-2")) return(XML_CHAR_ENCODING_8859_2);
Packit Service a31ea6
    if (!strcmp(upper,  "ISO LATIN 2")) return(XML_CHAR_ENCODING_8859_2);
Packit Service a31ea6
Packit Service a31ea6
    if (!strcmp(upper,  "ISO-8859-3")) return(XML_CHAR_ENCODING_8859_3);
Packit Service a31ea6
    if (!strcmp(upper,  "ISO-8859-4")) return(XML_CHAR_ENCODING_8859_4);
Packit Service a31ea6
    if (!strcmp(upper,  "ISO-8859-5")) return(XML_CHAR_ENCODING_8859_5);
Packit Service a31ea6
    if (!strcmp(upper,  "ISO-8859-6")) return(XML_CHAR_ENCODING_8859_6);
Packit Service a31ea6
    if (!strcmp(upper,  "ISO-8859-7")) return(XML_CHAR_ENCODING_8859_7);
Packit Service a31ea6
    if (!strcmp(upper,  "ISO-8859-8")) return(XML_CHAR_ENCODING_8859_8);
Packit Service a31ea6
    if (!strcmp(upper,  "ISO-8859-9")) return(XML_CHAR_ENCODING_8859_9);
Packit Service a31ea6
Packit Service a31ea6
    if (!strcmp(upper, "ISO-2022-JP")) return(XML_CHAR_ENCODING_2022_JP);
Packit Service a31ea6
    if (!strcmp(upper, "SHIFT_JIS")) return(XML_CHAR_ENCODING_SHIFT_JIS);
Packit Service a31ea6
    if (!strcmp(upper, "EUC-JP")) return(XML_CHAR_ENCODING_EUC_JP);
Packit Service a31ea6
Packit Service a31ea6
#ifdef DEBUG_ENCODING
Packit Service a31ea6
    xmlGenericError(xmlGenericErrorContext, "Unknown encoding %s\n", name);
Packit Service a31ea6
#endif
Packit Service a31ea6
    return(XML_CHAR_ENCODING_ERROR);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
/**
Packit Service a31ea6
 * xmlGetCharEncodingName:
Packit Service a31ea6
 * @enc:  the encoding
Packit Service a31ea6
 *
Packit Service a31ea6
 * The "canonical" name for XML encoding.
Packit Service a31ea6
 * C.f. http://www.w3.org/TR/REC-xml#charencoding
Packit Service a31ea6
 * Section 4.3.3  Character Encoding in Entities
Packit Service a31ea6
 *
Packit Service a31ea6
 * Returns the canonical name for the given encoding
Packit Service a31ea6
 */
Packit Service a31ea6
Packit Service a31ea6
const char*
Packit Service a31ea6
xmlGetCharEncodingName(xmlCharEncoding enc) {
Packit Service a31ea6
    switch (enc) {
Packit Service a31ea6
        case XML_CHAR_ENCODING_ERROR:
Packit Service a31ea6
	    return(NULL);
Packit Service a31ea6
        case XML_CHAR_ENCODING_NONE:
Packit Service a31ea6
	    return(NULL);
Packit Service a31ea6
        case XML_CHAR_ENCODING_UTF8:
Packit Service a31ea6
	    return("UTF-8");
Packit Service a31ea6
        case XML_CHAR_ENCODING_UTF16LE:
Packit Service a31ea6
	    return("UTF-16");
Packit Service a31ea6
        case XML_CHAR_ENCODING_UTF16BE:
Packit Service a31ea6
	    return("UTF-16");
Packit Service a31ea6
        case XML_CHAR_ENCODING_EBCDIC:
Packit Service a31ea6
            return("EBCDIC");
Packit Service a31ea6
        case XML_CHAR_ENCODING_UCS4LE:
Packit Service a31ea6
            return("ISO-10646-UCS-4");
Packit Service a31ea6
        case XML_CHAR_ENCODING_UCS4BE:
Packit Service a31ea6
            return("ISO-10646-UCS-4");
Packit Service a31ea6
        case XML_CHAR_ENCODING_UCS4_2143:
Packit Service a31ea6
            return("ISO-10646-UCS-4");
Packit Service a31ea6
        case XML_CHAR_ENCODING_UCS4_3412:
Packit Service a31ea6
            return("ISO-10646-UCS-4");
Packit Service a31ea6
        case XML_CHAR_ENCODING_UCS2:
Packit Service a31ea6
            return("ISO-10646-UCS-2");
Packit Service a31ea6
        case XML_CHAR_ENCODING_8859_1:
Packit Service a31ea6
	    return("ISO-8859-1");
Packit Service a31ea6
        case XML_CHAR_ENCODING_8859_2:
Packit Service a31ea6
	    return("ISO-8859-2");
Packit Service a31ea6
        case XML_CHAR_ENCODING_8859_3:
Packit Service a31ea6
	    return("ISO-8859-3");
Packit Service a31ea6
        case XML_CHAR_ENCODING_8859_4:
Packit Service a31ea6
	    return("ISO-8859-4");
Packit Service a31ea6
        case XML_CHAR_ENCODING_8859_5:
Packit Service a31ea6
	    return("ISO-8859-5");
Packit Service a31ea6
        case XML_CHAR_ENCODING_8859_6:
Packit Service a31ea6
	    return("ISO-8859-6");
Packit Service a31ea6
        case XML_CHAR_ENCODING_8859_7:
Packit Service a31ea6
	    return("ISO-8859-7");
Packit Service a31ea6
        case XML_CHAR_ENCODING_8859_8:
Packit Service a31ea6
	    return("ISO-8859-8");
Packit Service a31ea6
        case XML_CHAR_ENCODING_8859_9:
Packit Service a31ea6
	    return("ISO-8859-9");
Packit Service a31ea6
        case XML_CHAR_ENCODING_2022_JP:
Packit Service a31ea6
            return("ISO-2022-JP");
Packit Service a31ea6
        case XML_CHAR_ENCODING_SHIFT_JIS:
Packit Service a31ea6
            return("Shift-JIS");
Packit Service a31ea6
        case XML_CHAR_ENCODING_EUC_JP:
Packit Service a31ea6
            return("EUC-JP");
Packit Service a31ea6
	case XML_CHAR_ENCODING_ASCII:
Packit Service a31ea6
	    return(NULL);
Packit Service a31ea6
    }
Packit Service a31ea6
    return(NULL);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
/************************************************************************
Packit Service a31ea6
 *									*
Packit Service a31ea6
 *			Char encoding handlers				*
Packit Service a31ea6
 *									*
Packit Service a31ea6
 ************************************************************************/
Packit Service a31ea6
Packit Service a31ea6
Packit Service a31ea6
/* the size should be growable, but it's not a big deal ... */
Packit Service a31ea6
#define MAX_ENCODING_HANDLERS 50
Packit Service a31ea6
static xmlCharEncodingHandlerPtr *handlers = NULL;
Packit Service a31ea6
static int nbCharEncodingHandler = 0;
Packit Service a31ea6
Packit Service a31ea6
/*
Packit Service a31ea6
 * The default is UTF-8 for XML, that's also the default used for the
Packit Service a31ea6
 * parser internals, so the default encoding handler is NULL
Packit Service a31ea6
 */
Packit Service a31ea6
Packit Service a31ea6
static xmlCharEncodingHandlerPtr xmlDefaultCharEncodingHandler = NULL;
Packit Service a31ea6
Packit Service a31ea6
/**
Packit Service a31ea6
 * xmlNewCharEncodingHandler:
Packit Service a31ea6
 * @name:  the encoding name, in UTF-8 format (ASCII actually)
Packit Service a31ea6
 * @input:  the xmlCharEncodingInputFunc to read that encoding
Packit Service a31ea6
 * @output:  the xmlCharEncodingOutputFunc to write that encoding
Packit Service a31ea6
 *
Packit Service a31ea6
 * Create and registers an xmlCharEncodingHandler.
Packit Service a31ea6
 *
Packit Service a31ea6
 * Returns the xmlCharEncodingHandlerPtr created (or NULL in case of error).
Packit Service a31ea6
 */
Packit Service a31ea6
xmlCharEncodingHandlerPtr
Packit Service a31ea6
xmlNewCharEncodingHandler(const char *name,
Packit Service a31ea6
                          xmlCharEncodingInputFunc input,
Packit Service a31ea6
                          xmlCharEncodingOutputFunc output) {
Packit Service a31ea6
    xmlCharEncodingHandlerPtr handler;
Packit Service a31ea6
    const char *alias;
Packit Service a31ea6
    char upper[500];
Packit Service a31ea6
    int i;
Packit Service a31ea6
    char *up = NULL;
Packit Service a31ea6
Packit Service a31ea6
    /*
Packit Service a31ea6
     * Do the alias resolution
Packit Service a31ea6
     */
Packit Service a31ea6
    alias = xmlGetEncodingAlias(name);
Packit Service a31ea6
    if (alias != NULL)
Packit Service a31ea6
	name = alias;
Packit Service a31ea6
Packit Service a31ea6
    /*
Packit Service a31ea6
     * Keep only the uppercase version of the encoding.
Packit Service a31ea6
     */
Packit Service a31ea6
    if (name == NULL) {
Packit Service a31ea6
        xmlEncodingErr(XML_I18N_NO_NAME,
Packit Service a31ea6
		       "xmlNewCharEncodingHandler : no name !\n", NULL);
Packit Service a31ea6
	return(NULL);
Packit Service a31ea6
    }
Packit Service a31ea6
    for (i = 0;i < 499;i++) {
Packit Service a31ea6
        upper[i] = toupper(name[i]);
Packit Service a31ea6
	if (upper[i] == 0) break;
Packit Service a31ea6
    }
Packit Service a31ea6
    upper[i] = 0;
Packit Service a31ea6
    up = xmlMemStrdup(upper);
Packit Service a31ea6
    if (up == NULL) {
Packit Service a31ea6
        xmlEncodingErrMemory("xmlNewCharEncodingHandler : out of memory !\n");
Packit Service a31ea6
	return(NULL);
Packit Service a31ea6
    }
Packit Service a31ea6
Packit Service a31ea6
    /*
Packit Service a31ea6
     * allocate and fill-up an handler block.
Packit Service a31ea6
     */
Packit Service a31ea6
    handler = (xmlCharEncodingHandlerPtr)
Packit Service a31ea6
              xmlMalloc(sizeof(xmlCharEncodingHandler));
Packit Service a31ea6
    if (handler == NULL) {
Packit Service a31ea6
        xmlFree(up);
Packit Service a31ea6
        xmlEncodingErrMemory("xmlNewCharEncodingHandler : out of memory !\n");
Packit Service a31ea6
	return(NULL);
Packit Service a31ea6
    }
Packit Service a31ea6
    memset(handler, 0, sizeof(xmlCharEncodingHandler));
Packit Service a31ea6
    handler->input = input;
Packit Service a31ea6
    handler->output = output;
Packit Service a31ea6
    handler->name = up;
Packit Service a31ea6
Packit Service a31ea6
#ifdef LIBXML_ICONV_ENABLED
Packit Service a31ea6
    handler->iconv_in = NULL;
Packit Service a31ea6
    handler->iconv_out = NULL;
Packit Service a31ea6
#endif
Packit Service a31ea6
#ifdef LIBXML_ICU_ENABLED
Packit Service a31ea6
    handler->uconv_in = NULL;
Packit Service a31ea6
    handler->uconv_out = NULL;
Packit Service a31ea6
#endif
Packit Service a31ea6
Packit Service a31ea6
    /*
Packit Service a31ea6
     * registers and returns the handler.
Packit Service a31ea6
     */
Packit Service a31ea6
    xmlRegisterCharEncodingHandler(handler);
Packit Service a31ea6
#ifdef DEBUG_ENCODING
Packit Service a31ea6
    xmlGenericError(xmlGenericErrorContext,
Packit Service a31ea6
	    "Registered encoding handler for %s\n", name);
Packit Service a31ea6
#endif
Packit Service a31ea6
    return(handler);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
/**
Packit Service a31ea6
 * xmlInitCharEncodingHandlers:
Packit Service a31ea6
 *
Packit Service a31ea6
 * Initialize the char encoding support, it registers the default
Packit Service a31ea6
 * encoding supported.
Packit Service a31ea6
 * NOTE: while public, this function usually doesn't need to be called
Packit Service a31ea6
 *       in normal processing.
Packit Service a31ea6
 */
Packit Service a31ea6
void
Packit Service a31ea6
xmlInitCharEncodingHandlers(void) {
Packit Service a31ea6
    unsigned short int tst = 0x1234;
Packit Service a31ea6
    unsigned char *ptr = (unsigned char *) &tst;
Packit Service a31ea6
Packit Service a31ea6
    if (handlers != NULL) return;
Packit Service a31ea6
Packit Service a31ea6
    handlers = (xmlCharEncodingHandlerPtr *)
Packit Service a31ea6
        xmlMalloc(MAX_ENCODING_HANDLERS * sizeof(xmlCharEncodingHandlerPtr));
Packit Service a31ea6
Packit Service a31ea6
    if (*ptr == 0x12) xmlLittleEndian = 0;
Packit Service a31ea6
    else if (*ptr == 0x34) xmlLittleEndian = 1;
Packit Service a31ea6
    else {
Packit Service a31ea6
        xmlEncodingErr(XML_ERR_INTERNAL_ERROR,
Packit Service a31ea6
	               "Odd problem at endianness detection\n", NULL);
Packit Service a31ea6
    }
Packit Service a31ea6
Packit Service a31ea6
    if (handlers == NULL) {
Packit Service a31ea6
        xmlEncodingErrMemory("xmlInitCharEncodingHandlers : out of memory !\n");
Packit Service a31ea6
	return;
Packit Service a31ea6
    }
Packit Service a31ea6
    xmlNewCharEncodingHandler("UTF-8", UTF8ToUTF8, UTF8ToUTF8);
Packit Service a31ea6
#ifdef LIBXML_OUTPUT_ENABLED
Packit Service a31ea6
    xmlUTF16LEHandler =
Packit Service a31ea6
          xmlNewCharEncodingHandler("UTF-16LE", UTF16LEToUTF8, UTF8ToUTF16LE);
Packit Service a31ea6
    xmlUTF16BEHandler =
Packit Service a31ea6
          xmlNewCharEncodingHandler("UTF-16BE", UTF16BEToUTF8, UTF8ToUTF16BE);
Packit Service a31ea6
    xmlNewCharEncodingHandler("UTF-16", UTF16LEToUTF8, UTF8ToUTF16);
Packit Service a31ea6
    xmlNewCharEncodingHandler("ISO-8859-1", isolat1ToUTF8, UTF8Toisolat1);
Packit Service a31ea6
    xmlNewCharEncodingHandler("ASCII", asciiToUTF8, UTF8Toascii);
Packit Service a31ea6
    xmlNewCharEncodingHandler("US-ASCII", asciiToUTF8, UTF8Toascii);
Packit Service a31ea6
#ifdef LIBXML_HTML_ENABLED
Packit Service a31ea6
    xmlNewCharEncodingHandler("HTML", NULL, UTF8ToHtml);
Packit Service a31ea6
#endif
Packit Service a31ea6
#else
Packit Service a31ea6
    xmlUTF16LEHandler =
Packit Service a31ea6
          xmlNewCharEncodingHandler("UTF-16LE", UTF16LEToUTF8, NULL);
Packit Service a31ea6
    xmlUTF16BEHandler =
Packit Service a31ea6
          xmlNewCharEncodingHandler("UTF-16BE", UTF16BEToUTF8, NULL);
Packit Service a31ea6
    xmlNewCharEncodingHandler("UTF-16", UTF16LEToUTF8, NULL);
Packit Service a31ea6
    xmlNewCharEncodingHandler("ISO-8859-1", isolat1ToUTF8, NULL);
Packit Service a31ea6
    xmlNewCharEncodingHandler("ASCII", asciiToUTF8, NULL);
Packit Service a31ea6
    xmlNewCharEncodingHandler("US-ASCII", asciiToUTF8, NULL);
Packit Service a31ea6
#endif /* LIBXML_OUTPUT_ENABLED */
Packit Service a31ea6
#if !defined(LIBXML_ICONV_ENABLED) && !defined(LIBXML_ICU_ENABLED)
Packit Service a31ea6
#ifdef LIBXML_ISO8859X_ENABLED
Packit Service a31ea6
    xmlRegisterCharEncodingHandlersISO8859x ();
Packit Service a31ea6
#endif
Packit Service a31ea6
#endif
Packit Service a31ea6
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
/**
Packit Service a31ea6
 * xmlCleanupCharEncodingHandlers:
Packit Service a31ea6
 *
Packit Service a31ea6
 * Cleanup the memory allocated for the char encoding support, it
Packit Service a31ea6
 * unregisters all the encoding handlers and the aliases.
Packit Service a31ea6
 */
Packit Service a31ea6
void
Packit Service a31ea6
xmlCleanupCharEncodingHandlers(void) {
Packit Service a31ea6
    xmlCleanupEncodingAliases();
Packit Service a31ea6
Packit Service a31ea6
    if (handlers == NULL) return;
Packit Service a31ea6
Packit Service a31ea6
    for (;nbCharEncodingHandler > 0;) {
Packit Service a31ea6
        nbCharEncodingHandler--;
Packit Service a31ea6
	if (handlers[nbCharEncodingHandler] != NULL) {
Packit Service a31ea6
	    if (handlers[nbCharEncodingHandler]->name != NULL)
Packit Service a31ea6
		xmlFree(handlers[nbCharEncodingHandler]->name);
Packit Service a31ea6
	    xmlFree(handlers[nbCharEncodingHandler]);
Packit Service a31ea6
	}
Packit Service a31ea6
    }
Packit Service a31ea6
    xmlFree(handlers);
Packit Service a31ea6
    handlers = NULL;
Packit Service a31ea6
    nbCharEncodingHandler = 0;
Packit Service a31ea6
    xmlDefaultCharEncodingHandler = NULL;
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
/**
Packit Service a31ea6
 * xmlRegisterCharEncodingHandler:
Packit Service a31ea6
 * @handler:  the xmlCharEncodingHandlerPtr handler block
Packit Service a31ea6
 *
Packit Service a31ea6
 * Register the char encoding handler, surprising, isn't it ?
Packit Service a31ea6
 */
Packit Service a31ea6
void
Packit Service a31ea6
xmlRegisterCharEncodingHandler(xmlCharEncodingHandlerPtr handler) {
Packit Service a31ea6
    if (handlers == NULL) xmlInitCharEncodingHandlers();
Packit Service a31ea6
    if ((handler == NULL) || (handlers == NULL)) {
Packit Service a31ea6
        xmlEncodingErr(XML_I18N_NO_HANDLER,
Packit Service a31ea6
		"xmlRegisterCharEncodingHandler: NULL handler !\n", NULL);
Packit Service a31ea6
	return;
Packit Service a31ea6
    }
Packit Service a31ea6
Packit Service a31ea6
    if (nbCharEncodingHandler >= MAX_ENCODING_HANDLERS) {
Packit Service a31ea6
        xmlEncodingErr(XML_I18N_EXCESS_HANDLER,
Packit Service a31ea6
	"xmlRegisterCharEncodingHandler: Too many handler registered, see %s\n",
Packit Service a31ea6
	               "MAX_ENCODING_HANDLERS");
Packit Service a31ea6
	return;
Packit Service a31ea6
    }
Packit Service a31ea6
    handlers[nbCharEncodingHandler++] = handler;
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
/**
Packit Service a31ea6
 * xmlGetCharEncodingHandler:
Packit Service a31ea6
 * @enc:  an xmlCharEncoding value.
Packit Service a31ea6
 *
Packit Service a31ea6
 * Search in the registered set the handler able to read/write that encoding.
Packit Service a31ea6
 *
Packit Service a31ea6
 * Returns the handler or NULL if not found
Packit Service a31ea6
 */
Packit Service a31ea6
xmlCharEncodingHandlerPtr
Packit Service a31ea6
xmlGetCharEncodingHandler(xmlCharEncoding enc) {
Packit Service a31ea6
    xmlCharEncodingHandlerPtr handler;
Packit Service a31ea6
Packit Service a31ea6
    if (handlers == NULL) xmlInitCharEncodingHandlers();
Packit Service a31ea6
    switch (enc) {
Packit Service a31ea6
        case XML_CHAR_ENCODING_ERROR:
Packit Service a31ea6
	    return(NULL);
Packit Service a31ea6
        case XML_CHAR_ENCODING_NONE:
Packit Service a31ea6
	    return(NULL);
Packit Service a31ea6
        case XML_CHAR_ENCODING_UTF8:
Packit Service a31ea6
	    return(NULL);
Packit Service a31ea6
        case XML_CHAR_ENCODING_UTF16LE:
Packit Service a31ea6
	    return(xmlUTF16LEHandler);
Packit Service a31ea6
        case XML_CHAR_ENCODING_UTF16BE:
Packit Service a31ea6
	    return(xmlUTF16BEHandler);
Packit Service a31ea6
        case XML_CHAR_ENCODING_EBCDIC:
Packit Service a31ea6
            handler = xmlFindCharEncodingHandler("EBCDIC");
Packit Service a31ea6
            if (handler != NULL) return(handler);
Packit Service a31ea6
            handler = xmlFindCharEncodingHandler("ebcdic");
Packit Service a31ea6
            if (handler != NULL) return(handler);
Packit Service a31ea6
            handler = xmlFindCharEncodingHandler("EBCDIC-US");
Packit Service a31ea6
            if (handler != NULL) return(handler);
Packit Service a31ea6
            handler = xmlFindCharEncodingHandler("IBM-037");
Packit Service a31ea6
            if (handler != NULL) return(handler);
Packit Service a31ea6
	    break;
Packit Service a31ea6
        case XML_CHAR_ENCODING_UCS4BE:
Packit Service a31ea6
            handler = xmlFindCharEncodingHandler("ISO-10646-UCS-4");
Packit Service a31ea6
            if (handler != NULL) return(handler);
Packit Service a31ea6
            handler = xmlFindCharEncodingHandler("UCS-4");
Packit Service a31ea6
            if (handler != NULL) return(handler);
Packit Service a31ea6
            handler = xmlFindCharEncodingHandler("UCS4");
Packit Service a31ea6
            if (handler != NULL) return(handler);
Packit Service a31ea6
	    break;
Packit Service a31ea6
        case XML_CHAR_ENCODING_UCS4LE:
Packit Service a31ea6
            handler = xmlFindCharEncodingHandler("ISO-10646-UCS-4");
Packit Service a31ea6
            if (handler != NULL) return(handler);
Packit Service a31ea6
            handler = xmlFindCharEncodingHandler("UCS-4");
Packit Service a31ea6
            if (handler != NULL) return(handler);
Packit Service a31ea6
            handler = xmlFindCharEncodingHandler("UCS4");
Packit Service a31ea6
            if (handler != NULL) return(handler);
Packit Service a31ea6
	    break;
Packit Service a31ea6
        case XML_CHAR_ENCODING_UCS4_2143:
Packit Service a31ea6
	    break;
Packit Service a31ea6
        case XML_CHAR_ENCODING_UCS4_3412:
Packit Service a31ea6
	    break;
Packit Service a31ea6
        case XML_CHAR_ENCODING_UCS2:
Packit Service a31ea6
            handler = xmlFindCharEncodingHandler("ISO-10646-UCS-2");
Packit Service a31ea6
            if (handler != NULL) return(handler);
Packit Service a31ea6
            handler = xmlFindCharEncodingHandler("UCS-2");
Packit Service a31ea6
            if (handler != NULL) return(handler);
Packit Service a31ea6
            handler = xmlFindCharEncodingHandler("UCS2");
Packit Service a31ea6
            if (handler != NULL) return(handler);
Packit Service a31ea6
	    break;
Packit Service a31ea6
Packit Service a31ea6
	    /*
Packit Service a31ea6
	     * We used to keep ISO Latin encodings native in the
Packit Service a31ea6
	     * generated data. This led to so many problems that
Packit Service a31ea6
	     * this has been removed. One can still change this
Packit Service a31ea6
	     * back by registering no-ops encoders for those
Packit Service a31ea6
	     */
Packit Service a31ea6
        case XML_CHAR_ENCODING_8859_1:
Packit Service a31ea6
	    handler = xmlFindCharEncodingHandler("ISO-8859-1");
Packit Service a31ea6
	    if (handler != NULL) return(handler);
Packit Service a31ea6
	    break;
Packit Service a31ea6
        case XML_CHAR_ENCODING_8859_2:
Packit Service a31ea6
	    handler = xmlFindCharEncodingHandler("ISO-8859-2");
Packit Service a31ea6
	    if (handler != NULL) return(handler);
Packit Service a31ea6
	    break;
Packit Service a31ea6
        case XML_CHAR_ENCODING_8859_3:
Packit Service a31ea6
	    handler = xmlFindCharEncodingHandler("ISO-8859-3");
Packit Service a31ea6
	    if (handler != NULL) return(handler);
Packit Service a31ea6
	    break;
Packit Service a31ea6
        case XML_CHAR_ENCODING_8859_4:
Packit Service a31ea6
	    handler = xmlFindCharEncodingHandler("ISO-8859-4");
Packit Service a31ea6
	    if (handler != NULL) return(handler);
Packit Service a31ea6
	    break;
Packit Service a31ea6
        case XML_CHAR_ENCODING_8859_5:
Packit Service a31ea6
	    handler = xmlFindCharEncodingHandler("ISO-8859-5");
Packit Service a31ea6
	    if (handler != NULL) return(handler);
Packit Service a31ea6
	    break;
Packit Service a31ea6
        case XML_CHAR_ENCODING_8859_6:
Packit Service a31ea6
	    handler = xmlFindCharEncodingHandler("ISO-8859-6");
Packit Service a31ea6
	    if (handler != NULL) return(handler);
Packit Service a31ea6
	    break;
Packit Service a31ea6
        case XML_CHAR_ENCODING_8859_7:
Packit Service a31ea6
	    handler = xmlFindCharEncodingHandler("ISO-8859-7");
Packit Service a31ea6
	    if (handler != NULL) return(handler);
Packit Service a31ea6
	    break;
Packit Service a31ea6
        case XML_CHAR_ENCODING_8859_8:
Packit Service a31ea6
	    handler = xmlFindCharEncodingHandler("ISO-8859-8");
Packit Service a31ea6
	    if (handler != NULL) return(handler);
Packit Service a31ea6
	    break;
Packit Service a31ea6
        case XML_CHAR_ENCODING_8859_9:
Packit Service a31ea6
	    handler = xmlFindCharEncodingHandler("ISO-8859-9");
Packit Service a31ea6
	    if (handler != NULL) return(handler);
Packit Service a31ea6
	    break;
Packit Service a31ea6
Packit Service a31ea6
Packit Service a31ea6
        case XML_CHAR_ENCODING_2022_JP:
Packit Service a31ea6
            handler = xmlFindCharEncodingHandler("ISO-2022-JP");
Packit Service a31ea6
            if (handler != NULL) return(handler);
Packit Service a31ea6
	    break;
Packit Service a31ea6
        case XML_CHAR_ENCODING_SHIFT_JIS:
Packit Service a31ea6
            handler = xmlFindCharEncodingHandler("SHIFT-JIS");
Packit Service a31ea6
            if (handler != NULL) return(handler);
Packit Service a31ea6
            handler = xmlFindCharEncodingHandler("SHIFT_JIS");
Packit Service a31ea6
            if (handler != NULL) return(handler);
Packit Service a31ea6
            handler = xmlFindCharEncodingHandler("Shift_JIS");
Packit Service a31ea6
            if (handler != NULL) return(handler);
Packit Service a31ea6
	    break;
Packit Service a31ea6
        case XML_CHAR_ENCODING_EUC_JP:
Packit Service a31ea6
            handler = xmlFindCharEncodingHandler("EUC-JP");
Packit Service a31ea6
            if (handler != NULL) return(handler);
Packit Service a31ea6
	    break;
Packit Service a31ea6
	default:
Packit Service a31ea6
	    break;
Packit Service a31ea6
    }
Packit Service a31ea6
Packit Service a31ea6
#ifdef DEBUG_ENCODING
Packit Service a31ea6
    xmlGenericError(xmlGenericErrorContext,
Packit Service a31ea6
	    "No handler found for encoding %d\n", enc);
Packit Service a31ea6
#endif
Packit Service a31ea6
    return(NULL);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
/**
Packit Service a31ea6
 * xmlFindCharEncodingHandler:
Packit Service a31ea6
 * @name:  a string describing the char encoding.
Packit Service a31ea6
 *
Packit Service a31ea6
 * Search in the registered set the handler able to read/write that encoding.
Packit Service a31ea6
 *
Packit Service a31ea6
 * Returns the handler or NULL if not found
Packit Service a31ea6
 */
Packit Service a31ea6
xmlCharEncodingHandlerPtr
Packit Service a31ea6
xmlFindCharEncodingHandler(const char *name) {
Packit Service a31ea6
    const char *nalias;
Packit Service a31ea6
    const char *norig;
Packit Service a31ea6
    xmlCharEncoding alias;
Packit Service a31ea6
#ifdef LIBXML_ICONV_ENABLED
Packit Service a31ea6
    xmlCharEncodingHandlerPtr enc;
Packit Service a31ea6
    iconv_t icv_in, icv_out;
Packit Service a31ea6
#endif /* LIBXML_ICONV_ENABLED */
Packit Service a31ea6
#ifdef LIBXML_ICU_ENABLED
Packit Service a31ea6
    xmlCharEncodingHandlerPtr encu;
Packit Service a31ea6
    uconv_t *ucv_in, *ucv_out;
Packit Service a31ea6
#endif /* LIBXML_ICU_ENABLED */
Packit Service a31ea6
    char upper[100];
Packit Service a31ea6
    int i;
Packit Service a31ea6
Packit Service a31ea6
    if (handlers == NULL) xmlInitCharEncodingHandlers();
Packit Service a31ea6
    if (name == NULL) return(xmlDefaultCharEncodingHandler);
Packit Service a31ea6
    if (name[0] == 0) return(xmlDefaultCharEncodingHandler);
Packit Service a31ea6
Packit Service a31ea6
    /*
Packit Service a31ea6
     * Do the alias resolution
Packit Service a31ea6
     */
Packit Service a31ea6
    norig = name;
Packit Service a31ea6
    nalias = xmlGetEncodingAlias(name);
Packit Service a31ea6
    if (nalias != NULL)
Packit Service a31ea6
	name = nalias;
Packit Service a31ea6
Packit Service a31ea6
    /*
Packit Service a31ea6
     * Check first for directly registered encoding names
Packit Service a31ea6
     */
Packit Service a31ea6
    for (i = 0;i < 99;i++) {
Packit Service a31ea6
        upper[i] = toupper(name[i]);
Packit Service a31ea6
	if (upper[i] == 0) break;
Packit Service a31ea6
    }
Packit Service a31ea6
    upper[i] = 0;
Packit Service a31ea6
Packit Service a31ea6
    if (handlers != NULL) {
Packit Service a31ea6
        for (i = 0;i < nbCharEncodingHandler; i++) {
Packit Service a31ea6
            if (!strcmp(upper, handlers[i]->name)) {
Packit Service a31ea6
#ifdef DEBUG_ENCODING
Packit Service a31ea6
                xmlGenericError(xmlGenericErrorContext,
Packit Service a31ea6
                        "Found registered handler for encoding %s\n", name);
Packit Service a31ea6
#endif
Packit Service a31ea6
                return(handlers[i]);
Packit Service a31ea6
            }
Packit Service a31ea6
        }
Packit Service a31ea6
    }
Packit Service a31ea6
Packit Service a31ea6
#ifdef LIBXML_ICONV_ENABLED
Packit Service a31ea6
    /* check whether iconv can handle this */
Packit Service a31ea6
    icv_in = iconv_open("UTF-8", name);
Packit Service a31ea6
    icv_out = iconv_open(name, "UTF-8");
Packit Service a31ea6
    if (icv_in == (iconv_t) -1) {
Packit Service a31ea6
        icv_in = iconv_open("UTF-8", upper);
Packit Service a31ea6
    }
Packit Service a31ea6
    if (icv_out == (iconv_t) -1) {
Packit Service a31ea6
	icv_out = iconv_open(upper, "UTF-8");
Packit Service a31ea6
    }
Packit Service a31ea6
    if ((icv_in != (iconv_t) -1) && (icv_out != (iconv_t) -1)) {
Packit Service a31ea6
	    enc = (xmlCharEncodingHandlerPtr)
Packit Service a31ea6
	          xmlMalloc(sizeof(xmlCharEncodingHandler));
Packit Service a31ea6
	    if (enc == NULL) {
Packit Service a31ea6
	        iconv_close(icv_in);
Packit Service a31ea6
	        iconv_close(icv_out);
Packit Service a31ea6
		return(NULL);
Packit Service a31ea6
	    }
Packit Service a31ea6
            memset(enc, 0, sizeof(xmlCharEncodingHandler));
Packit Service a31ea6
	    enc->name = xmlMemStrdup(name);
Packit Service a31ea6
	    enc->input = NULL;
Packit Service a31ea6
	    enc->output = NULL;
Packit Service a31ea6
	    enc->iconv_in = icv_in;
Packit Service a31ea6
	    enc->iconv_out = icv_out;
Packit Service a31ea6
#ifdef DEBUG_ENCODING
Packit Service a31ea6
            xmlGenericError(xmlGenericErrorContext,
Packit Service a31ea6
		    "Found iconv handler for encoding %s\n", name);
Packit Service a31ea6
#endif
Packit Service a31ea6
	    return enc;
Packit Service a31ea6
    } else if ((icv_in != (iconv_t) -1) || icv_out != (iconv_t) -1) {
Packit Service a31ea6
	    xmlEncodingErr(XML_ERR_INTERNAL_ERROR,
Packit Service a31ea6
		    "iconv : problems with filters for '%s'\n", name);
Packit Service a31ea6
    }
Packit Service a31ea6
#endif /* LIBXML_ICONV_ENABLED */
Packit Service a31ea6
#ifdef LIBXML_ICU_ENABLED
Packit Service a31ea6
    /* check whether icu can handle this */
Packit Service a31ea6
    ucv_in = openIcuConverter(name, 1);
Packit Service a31ea6
    ucv_out = openIcuConverter(name, 0);
Packit Service a31ea6
    if (ucv_in != NULL && ucv_out != NULL) {
Packit Service a31ea6
	    encu = (xmlCharEncodingHandlerPtr)
Packit Service a31ea6
	           xmlMalloc(sizeof(xmlCharEncodingHandler));
Packit Service a31ea6
	    if (encu == NULL) {
Packit Service a31ea6
                closeIcuConverter(ucv_in);
Packit Service a31ea6
                closeIcuConverter(ucv_out);
Packit Service a31ea6
		return(NULL);
Packit Service a31ea6
	    }
Packit Service a31ea6
            memset(encu, 0, sizeof(xmlCharEncodingHandler));
Packit Service a31ea6
	    encu->name = xmlMemStrdup(name);
Packit Service a31ea6
	    encu->input = NULL;
Packit Service a31ea6
	    encu->output = NULL;
Packit Service a31ea6
	    encu->uconv_in = ucv_in;
Packit Service a31ea6
	    encu->uconv_out = ucv_out;
Packit Service a31ea6
#ifdef DEBUG_ENCODING
Packit Service a31ea6
            xmlGenericError(xmlGenericErrorContext,
Packit Service a31ea6
		    "Found ICU converter handler for encoding %s\n", name);
Packit Service a31ea6
#endif
Packit Service a31ea6
	    return encu;
Packit Service a31ea6
    } else if (ucv_in != NULL || ucv_out != NULL) {
Packit Service a31ea6
            closeIcuConverter(ucv_in);
Packit Service a31ea6
            closeIcuConverter(ucv_out);
Packit Service a31ea6
	    xmlEncodingErr(XML_ERR_INTERNAL_ERROR,
Packit Service a31ea6
		    "ICU converter : problems with filters for '%s'\n", name);
Packit Service a31ea6
    }
Packit Service a31ea6
#endif /* LIBXML_ICU_ENABLED */
Packit Service a31ea6
Packit Service a31ea6
#ifdef DEBUG_ENCODING
Packit Service a31ea6
    xmlGenericError(xmlGenericErrorContext,
Packit Service a31ea6
	    "No handler found for encoding %s\n", name);
Packit Service a31ea6
#endif
Packit Service a31ea6
Packit Service a31ea6
    /*
Packit Service a31ea6
     * Fallback using the canonical names
Packit Service a31ea6
     */
Packit Service a31ea6
    alias = xmlParseCharEncoding(norig);
Packit Service a31ea6
    if (alias != XML_CHAR_ENCODING_ERROR) {
Packit Service a31ea6
        const char* canon;
Packit Service a31ea6
        canon = xmlGetCharEncodingName(alias);
Packit Service a31ea6
        if ((canon != NULL) && (strcmp(name, canon))) {
Packit Service a31ea6
	    return(xmlFindCharEncodingHandler(canon));
Packit Service a31ea6
        }
Packit Service a31ea6
    }
Packit Service a31ea6
Packit Service a31ea6
    /* If "none of the above", give up */
Packit Service a31ea6
    return(NULL);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
/************************************************************************
Packit Service a31ea6
 *									*
Packit Service a31ea6
 *		ICONV based generic conversion functions		*
Packit Service a31ea6
 *									*
Packit Service a31ea6
 ************************************************************************/
Packit Service a31ea6
Packit Service a31ea6
#ifdef LIBXML_ICONV_ENABLED
Packit Service a31ea6
/**
Packit Service a31ea6
 * xmlIconvWrapper:
Packit Service a31ea6
 * @cd:		iconv converter data structure
Packit Service a31ea6
 * @out:  a pointer to an array of bytes to store the result
Packit Service a31ea6
 * @outlen:  the length of @out
Packit Service a31ea6
 * @in:  a pointer to an array of ISO Latin 1 chars
Packit Service a31ea6
 * @inlen:  the length of @in
Packit Service a31ea6
 *
Packit Service a31ea6
 * Returns 0 if success, or
Packit Service a31ea6
 *     -1 by lack of space, or
Packit Service a31ea6
 *     -2 if the transcoding fails (for *in is not valid utf8 string or
Packit Service a31ea6
 *        the result of transformation can't fit into the encoding we want), or
Packit Service a31ea6
 *     -3 if there the last byte can't form a single output char.
Packit Service a31ea6
 *
Packit Service a31ea6
 * The value of @inlen after return is the number of octets consumed
Packit Service a31ea6
 *     as the return value is positive, else unpredictable.
Packit Service a31ea6
 * The value of @outlen after return is the number of ocetes consumed.
Packit Service a31ea6
 */
Packit Service a31ea6
static int
Packit Service a31ea6
xmlIconvWrapper(iconv_t cd, unsigned char *out, int *outlen,
Packit Service a31ea6
                const unsigned char *in, int *inlen) {
Packit Service a31ea6
    size_t icv_inlen, icv_outlen;
Packit Service a31ea6
    const char *icv_in = (const char *) in;
Packit Service a31ea6
    char *icv_out = (char *) out;
Packit Service a31ea6
    int ret;
Packit Service a31ea6
Packit Service a31ea6
    if ((out == NULL) || (outlen == NULL) || (inlen == NULL) || (in == NULL)) {
Packit Service a31ea6
        if (outlen != NULL) *outlen = 0;
Packit Service a31ea6
        return(-1);
Packit Service a31ea6
    }
Packit Service a31ea6
    icv_inlen = *inlen;
Packit Service a31ea6
    icv_outlen = *outlen;
Packit Service a31ea6
    ret = iconv(cd, (ICONV_CONST char **) &icv_in, &icv_inlen, &icv_out, &icv_outlen);
Packit Service a31ea6
    *inlen -= icv_inlen;
Packit Service a31ea6
    *outlen -= icv_outlen;
Packit Service a31ea6
    if ((icv_inlen != 0) || (ret == -1)) {
Packit Service a31ea6
#ifdef EILSEQ
Packit Service a31ea6
        if (errno == EILSEQ) {
Packit Service a31ea6
            return -2;
Packit Service a31ea6
        } else
Packit Service a31ea6
#endif
Packit Service a31ea6
#ifdef E2BIG
Packit Service a31ea6
        if (errno == E2BIG) {
Packit Service a31ea6
            return -1;
Packit Service a31ea6
        } else
Packit Service a31ea6
#endif
Packit Service a31ea6
#ifdef EINVAL
Packit Service a31ea6
        if (errno == EINVAL) {
Packit Service a31ea6
            return -3;
Packit Service a31ea6
        } else
Packit Service a31ea6
#endif
Packit Service a31ea6
        {
Packit Service a31ea6
            return -3;
Packit Service a31ea6
        }
Packit Service a31ea6
    }
Packit Service a31ea6
    return 0;
Packit Service a31ea6
}
Packit Service a31ea6
#endif /* LIBXML_ICONV_ENABLED */
Packit Service a31ea6
Packit Service a31ea6
/************************************************************************
Packit Service a31ea6
 *									*
Packit Service a31ea6
 *		ICU based generic conversion functions		*
Packit Service a31ea6
 *									*
Packit Service a31ea6
 ************************************************************************/
Packit Service a31ea6
Packit Service a31ea6
#ifdef LIBXML_ICU_ENABLED
Packit Service a31ea6
/**
Packit Service a31ea6
 * xmlUconvWrapper:
Packit Service a31ea6
 * @cd: ICU uconverter data structure
Packit Service a31ea6
 * @toUnicode : non-zero if toUnicode. 0 otherwise.
Packit Service a31ea6
 * @out:  a pointer to an array of bytes to store the result
Packit Service a31ea6
 * @outlen:  the length of @out
Packit Service a31ea6
 * @in:  a pointer to an array of ISO Latin 1 chars
Packit Service a31ea6
 * @inlen:  the length of @in
Packit Service a31ea6
 *
Packit Service a31ea6
 * Returns 0 if success, or
Packit Service a31ea6
 *     -1 by lack of space, or
Packit Service a31ea6
 *     -2 if the transcoding fails (for *in is not valid utf8 string or
Packit Service a31ea6
 *        the result of transformation can't fit into the encoding we want), or
Packit Service a31ea6
 *     -3 if there the last byte can't form a single output char.
Packit Service a31ea6
 *
Packit Service a31ea6
 * The value of @inlen after return is the number of octets consumed
Packit Service a31ea6
 *     as the return value is positive, else unpredictable.
Packit Service a31ea6
 * The value of @outlen after return is the number of ocetes consumed.
Packit Service a31ea6
 */
Packit Service a31ea6
static int
Packit Service a31ea6
xmlUconvWrapper(uconv_t *cd, int toUnicode, unsigned char *out, int *outlen,
Packit Service a31ea6
                const unsigned char *in, int *inlen) {
Packit Service a31ea6
    const char *ucv_in = (const char *) in;
Packit Service a31ea6
    char *ucv_out = (char *) out;
Packit Service a31ea6
    UErrorCode err = U_ZERO_ERROR;
Packit Service a31ea6
Packit Service a31ea6
    if ((out == NULL) || (outlen == NULL) || (inlen == NULL) || (in == NULL)) {
Packit Service a31ea6
        if (outlen != NULL) *outlen = 0;
Packit Service a31ea6
        return(-1);
Packit Service a31ea6
    }
Packit Service a31ea6
Packit Service a31ea6
    /*
Packit Service a31ea6
     * TODO(jungshik)
Packit Service a31ea6
     * 1. is ucnv_convert(To|From)Algorithmic better?
Packit Service a31ea6
     * 2. had we better use an explicit pivot buffer?
Packit Service a31ea6
     * 3. error returned comes from 'fromUnicode' only even
Packit Service a31ea6
     *    when toUnicode is true !
Packit Service a31ea6
     */
Packit Service a31ea6
    if (toUnicode) {
Packit Service a31ea6
        /* encoding => UTF-16 => UTF-8 */
Packit Service a31ea6
        ucnv_convertEx(cd->utf8, cd->uconv, &ucv_out, ucv_out + *outlen,
Packit Service a31ea6
                       &ucv_in, ucv_in + *inlen, NULL, NULL, NULL, NULL,
Packit Service a31ea6
                       0, TRUE, &err;;
Packit Service a31ea6
    } else {
Packit Service a31ea6
        /* UTF-8 => UTF-16 => encoding */
Packit Service a31ea6
        ucnv_convertEx(cd->uconv, cd->utf8, &ucv_out, ucv_out + *outlen,
Packit Service a31ea6
                       &ucv_in, ucv_in + *inlen, NULL, NULL, NULL, NULL,
Packit Service a31ea6
                       0, TRUE, &err;;
Packit Service a31ea6
    }
Packit Service a31ea6
    *inlen = ucv_in - (const char*) in;
Packit Service a31ea6
    *outlen = ucv_out - (char *) out;
Packit Service a31ea6
    if (U_SUCCESS(err))
Packit Service a31ea6
        return 0;
Packit Service a31ea6
    if (err == U_BUFFER_OVERFLOW_ERROR)
Packit Service a31ea6
        return -1;
Packit Service a31ea6
    if (err == U_INVALID_CHAR_FOUND || err == U_ILLEGAL_CHAR_FOUND)
Packit Service a31ea6
        return -2;
Packit Service a31ea6
    /* if (err == U_TRUNCATED_CHAR_FOUND) */
Packit Service a31ea6
    return -3;
Packit Service a31ea6
}
Packit Service a31ea6
#endif /* LIBXML_ICU_ENABLED */
Packit Service a31ea6
Packit Service a31ea6
/************************************************************************
Packit Service a31ea6
 *									*
Packit Service a31ea6
 *		The real API used by libxml for on-the-fly conversion	*
Packit Service a31ea6
 *									*
Packit Service a31ea6
 ************************************************************************/
Packit Service a31ea6
Packit Service a31ea6
static int
Packit Service a31ea6
xmlEncInputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
Packit Service a31ea6
                 int *outlen, const unsigned char *in, int *inlen) {
Packit Service a31ea6
    int ret;
Packit Service a31ea6
Packit Service a31ea6
    if (handler->input != NULL) {
Packit Service a31ea6
        ret = handler->input(out, outlen, in, inlen);
Packit Service a31ea6
    }
Packit Service a31ea6
#ifdef LIBXML_ICONV_ENABLED
Packit Service a31ea6
    else if (handler->iconv_in != NULL) {
Packit Service a31ea6
        ret = xmlIconvWrapper(handler->iconv_in, out, outlen, in, inlen);
Packit Service a31ea6
    }
Packit Service a31ea6
#endif /* LIBXML_ICONV_ENABLED */
Packit Service a31ea6
#ifdef LIBXML_ICU_ENABLED
Packit Service a31ea6
    else if (handler->uconv_in != NULL) {
Packit Service a31ea6
        ret = xmlUconvWrapper(handler->uconv_in, 1, out, outlen, in, inlen);
Packit Service a31ea6
    }
Packit Service a31ea6
#endif /* LIBXML_ICU_ENABLED */
Packit Service a31ea6
    else {
Packit Service a31ea6
        *outlen = 0;
Packit Service a31ea6
        *inlen = 0;
Packit Service a31ea6
        ret = -2;
Packit Service a31ea6
    }
Packit Service a31ea6
Packit Service a31ea6
    return(ret);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
/* Returns -4 if no output function was found. */
Packit Service a31ea6
static int
Packit Service a31ea6
xmlEncOutputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
Packit Service a31ea6
                  int *outlen, const unsigned char *in, int *inlen) {
Packit Service a31ea6
    int ret;
Packit Service a31ea6
Packit Service a31ea6
    if (handler->output != NULL) {
Packit Service a31ea6
        ret = handler->output(out, outlen, in, inlen);
Packit Service a31ea6
    }
Packit Service a31ea6
#ifdef LIBXML_ICONV_ENABLED
Packit Service a31ea6
    else if (handler->iconv_out != NULL) {
Packit Service a31ea6
        ret = xmlIconvWrapper(handler->iconv_out, out, outlen, in, inlen);
Packit Service a31ea6
    }
Packit Service a31ea6
#endif /* LIBXML_ICONV_ENABLED */
Packit Service a31ea6
#ifdef LIBXML_ICU_ENABLED
Packit Service a31ea6
    else if (handler->uconv_out != NULL) {
Packit Service a31ea6
        ret = xmlUconvWrapper(handler->uconv_out, 0, out, outlen, in, inlen);
Packit Service a31ea6
    }
Packit Service a31ea6
#endif /* LIBXML_ICU_ENABLED */
Packit Service a31ea6
    else {
Packit Service a31ea6
        *outlen = 0;
Packit Service a31ea6
        *inlen = 0;
Packit Service a31ea6
        ret = -4;
Packit Service a31ea6
    }
Packit Service a31ea6
Packit Service a31ea6
    return(ret);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
/**
Packit Service a31ea6
 * xmlCharEncFirstLineInt:
Packit Service a31ea6
 * @handler:	char enconding transformation data structure
Packit Service a31ea6
 * @out:  an xmlBuffer for the output.
Packit Service a31ea6
 * @in:  an xmlBuffer for the input
Packit Service a31ea6
 * @len:  number of bytes to convert for the first line, or -1
Packit Service a31ea6
 *
Packit Service a31ea6
 * Front-end for the encoding handler input function, but handle only
Packit Service a31ea6
 * the very first line, i.e. limit itself to 45 chars.
Packit Service a31ea6
 *
Packit Service a31ea6
 * Returns the number of byte written if success, or
Packit Service a31ea6
 *     -1 general error
Packit Service a31ea6
 *     -2 if the transcoding fails (for *in is not valid utf8 string or
Packit Service a31ea6
 *        the result of transformation can't fit into the encoding we want), or
Packit Service a31ea6
 */
Packit Service a31ea6
int
Packit Service a31ea6
xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out,
Packit Service a31ea6
                       xmlBufferPtr in, int len) {
Packit Service a31ea6
    int ret;
Packit Service a31ea6
    int written;
Packit Service a31ea6
    int toconv;
Packit Service a31ea6
Packit Service a31ea6
    if (handler == NULL) return(-1);
Packit Service a31ea6
    if (out == NULL) return(-1);
Packit Service a31ea6
    if (in == NULL) return(-1);
Packit Service a31ea6
Packit Service a31ea6
    /* calculate space available */
Packit Service a31ea6
    written = out->size - out->use - 1; /* count '\0' */
Packit Service a31ea6
    toconv = in->use;
Packit Service a31ea6
    /*
Packit Service a31ea6
     * echo '' | wc -c => 38
Packit Service a31ea6
     * 45 chars should be sufficient to reach the end of the encoding
Packit Service a31ea6
     * declaration without going too far inside the document content.
Packit Service a31ea6
     * on UTF-16 this means 90bytes, on UCS4 this means 180
Packit Service a31ea6
     * The actual value depending on guessed encoding is passed as @len
Packit Service a31ea6
     * if provided
Packit Service a31ea6
     */
Packit Service a31ea6
    if (len >= 0) {
Packit Service a31ea6
        if (toconv > len)
Packit Service a31ea6
            toconv = len;
Packit Service a31ea6
    } else {
Packit Service a31ea6
        if (toconv > 180)
Packit Service a31ea6
            toconv = 180;
Packit Service a31ea6
    }
Packit Service a31ea6
    if (toconv * 2 >= written) {
Packit Service a31ea6
        xmlBufferGrow(out, toconv * 2);
Packit Service a31ea6
	written = out->size - out->use - 1;
Packit Service a31ea6
    }
Packit Service a31ea6
Packit Service a31ea6
    ret = xmlEncInputChunk(handler, &out->content[out->use], &written,
Packit Service a31ea6
                           in->content, &toconv);
Packit Service a31ea6
    xmlBufferShrink(in, toconv);
Packit Service a31ea6
    out->use += written;
Packit Service a31ea6
    out->content[out->use] = 0;
Packit Service a31ea6
    if (ret == -1) ret = -3;
Packit Service a31ea6
Packit Service a31ea6
#ifdef DEBUG_ENCODING
Packit Service a31ea6
    switch (ret) {
Packit Service a31ea6
        case 0:
Packit Service a31ea6
	    xmlGenericError(xmlGenericErrorContext,
Packit Service a31ea6
		    "converted %d bytes to %d bytes of input\n",
Packit Service a31ea6
	            toconv, written);
Packit Service a31ea6
	    break;
Packit Service a31ea6
        case -1:
Packit Service a31ea6
	    xmlGenericError(xmlGenericErrorContext,"converted %d bytes to %d bytes of input, %d left\n",
Packit Service a31ea6
	            toconv, written, in->use);
Packit Service a31ea6
	    break;
Packit Service a31ea6
        case -2:
Packit Service a31ea6
	    xmlGenericError(xmlGenericErrorContext,
Packit Service a31ea6
		    "input conversion failed due to input error\n");
Packit Service a31ea6
	    break;
Packit Service a31ea6
        case -3:
Packit Service a31ea6
	    xmlGenericError(xmlGenericErrorContext,"converted %d bytes to %d bytes of input, %d left\n",
Packit Service a31ea6
	            toconv, written, in->use);
Packit Service a31ea6
	    break;
Packit Service a31ea6
	default:
Packit Service a31ea6
	    xmlGenericError(xmlGenericErrorContext,"Unknown input conversion failed %d\n", ret);
Packit Service a31ea6
    }
Packit Service a31ea6
#endif /* DEBUG_ENCODING */
Packit Service a31ea6
    /*
Packit Service a31ea6
     * Ignore when input buffer is not on a boundary
Packit Service a31ea6
     */
Packit Service a31ea6
    if (ret == -3) ret = 0;
Packit Service a31ea6
    if (ret == -1) ret = 0;
Packit Service a31ea6
    return(ret);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
/**
Packit Service a31ea6
 * xmlCharEncFirstLine:
Packit Service a31ea6
 * @handler:	char enconding transformation data structure
Packit Service a31ea6
 * @out:  an xmlBuffer for the output.
Packit Service a31ea6
 * @in:  an xmlBuffer for the input
Packit Service a31ea6
 *
Packit Service a31ea6
 * Front-end for the encoding handler input function, but handle only
Packit Service a31ea6
 * the very first line, i.e. limit itself to 45 chars.
Packit Service a31ea6
 *
Packit Service a31ea6
 * Returns the number of byte written if success, or
Packit Service a31ea6
 *     -1 general error
Packit Service a31ea6
 *     -2 if the transcoding fails (for *in is not valid utf8 string or
Packit Service a31ea6
 *        the result of transformation can't fit into the encoding we want), or
Packit Service a31ea6
 */
Packit Service a31ea6
int
Packit Service a31ea6
xmlCharEncFirstLine(xmlCharEncodingHandler *handler, xmlBufferPtr out,
Packit Service a31ea6
                 xmlBufferPtr in) {
Packit Service a31ea6
    return(xmlCharEncFirstLineInt(handler, out, in, -1));
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
/**
Packit Service a31ea6
 * xmlCharEncFirstLineInput:
Packit Service a31ea6
 * @input: a parser input buffer
Packit Service a31ea6
 * @len:  number of bytes to convert for the first line, or -1
Packit Service a31ea6
 *
Packit Service a31ea6
 * Front-end for the encoding handler input function, but handle only
Packit Service a31ea6
 * the very first line. Point is that this is based on autodetection
Packit Service a31ea6
 * of the encoding and once that first line is converted we may find
Packit Service a31ea6
 * out that a different decoder is needed to process the input.
Packit Service a31ea6
 *
Packit Service a31ea6
 * Returns the number of byte written if success, or
Packit Service a31ea6
 *     -1 general error
Packit Service a31ea6
 *     -2 if the transcoding fails (for *in is not valid utf8 string or
Packit Service a31ea6
 *        the result of transformation can't fit into the encoding we want), or
Packit Service a31ea6
 */
Packit Service a31ea6
int
Packit Service a31ea6
xmlCharEncFirstLineInput(xmlParserInputBufferPtr input, int len)
Packit Service a31ea6
{
Packit Service a31ea6
    int ret;
Packit Service a31ea6
    size_t written;
Packit Service a31ea6
    size_t toconv;
Packit Service a31ea6
    int c_in;
Packit Service a31ea6
    int c_out;
Packit Service a31ea6
    xmlBufPtr in;
Packit Service a31ea6
    xmlBufPtr out;
Packit Service a31ea6
Packit Service a31ea6
    if ((input == NULL) || (input->encoder == NULL) ||
Packit Service a31ea6
        (input->buffer == NULL) || (input->raw == NULL))
Packit Service a31ea6
        return (-1);
Packit Service a31ea6
    out = input->buffer;
Packit Service a31ea6
    in = input->raw;
Packit Service a31ea6
Packit Service a31ea6
    toconv = xmlBufUse(in);
Packit Service a31ea6
    if (toconv == 0)
Packit Service a31ea6
        return (0);
Packit Service a31ea6
    written = xmlBufAvail(out) - 1; /* count '\0' */
Packit Service a31ea6
    /*
Packit Service a31ea6
     * echo '' | wc -c => 38
Packit Service a31ea6
     * 45 chars should be sufficient to reach the end of the encoding
Packit Service a31ea6
     * declaration without going too far inside the document content.
Packit Service a31ea6
     * on UTF-16 this means 90bytes, on UCS4 this means 180
Packit Service a31ea6
     * The actual value depending on guessed encoding is passed as @len
Packit Service a31ea6
     * if provided
Packit Service a31ea6
     */
Packit Service a31ea6
    if (len >= 0) {
Packit Service a31ea6
        if (toconv > (unsigned int) len)
Packit Service a31ea6
            toconv = len;
Packit Service a31ea6
    } else {
Packit Service a31ea6
        if (toconv > 180)
Packit Service a31ea6
            toconv = 180;
Packit Service a31ea6
    }
Packit Service a31ea6
    if (toconv * 2 >= written) {
Packit Service a31ea6
        xmlBufGrow(out, toconv * 2);
Packit Service a31ea6
        written = xmlBufAvail(out) - 1;
Packit Service a31ea6
    }
Packit Service a31ea6
    if (written > 360)
Packit Service a31ea6
        written = 360;
Packit Service a31ea6
Packit Service a31ea6
    c_in = toconv;
Packit Service a31ea6
    c_out = written;
Packit Service a31ea6
    ret = xmlEncInputChunk(input->encoder, xmlBufEnd(out), &c_out,
Packit Service a31ea6
                           xmlBufContent(in), &c_in);
Packit Service a31ea6
    xmlBufShrink(in, c_in);
Packit Service a31ea6
    xmlBufAddLen(out, c_out);
Packit Service a31ea6
    if (ret == -1)
Packit Service a31ea6
        ret = -3;
Packit Service a31ea6
Packit Service a31ea6
    switch (ret) {
Packit Service a31ea6
        case 0:
Packit Service a31ea6
#ifdef DEBUG_ENCODING
Packit Service a31ea6
            xmlGenericError(xmlGenericErrorContext,
Packit Service a31ea6
                            "converted %d bytes to %d bytes of input\n",
Packit Service a31ea6
                            c_in, c_out);
Packit Service a31ea6
#endif
Packit Service a31ea6
            break;
Packit Service a31ea6
        case -1:
Packit Service a31ea6
#ifdef DEBUG_ENCODING
Packit Service a31ea6
            xmlGenericError(xmlGenericErrorContext,
Packit Service a31ea6
                         "converted %d bytes to %d bytes of input, %d left\n",
Packit Service a31ea6
                            c_in, c_out, (int)xmlBufUse(in));
Packit Service a31ea6
#endif
Packit Service a31ea6
            break;
Packit Service a31ea6
        case -3:
Packit Service a31ea6
#ifdef DEBUG_ENCODING
Packit Service a31ea6
            xmlGenericError(xmlGenericErrorContext,
Packit Service a31ea6
                        "converted %d bytes to %d bytes of input, %d left\n",
Packit Service a31ea6
                            c_in, c_out, (int)xmlBufUse(in));
Packit Service a31ea6
#endif
Packit Service a31ea6
            break;
Packit Service a31ea6
        case -2: {
Packit Service a31ea6
            char buf[50];
Packit Service a31ea6
            const xmlChar *content = xmlBufContent(in);
Packit Service a31ea6
Packit Service a31ea6
	    snprintf(&buf[0], 49, "0x%02X 0x%02X 0x%02X 0x%02X",
Packit Service a31ea6
		     content[0], content[1],
Packit Service a31ea6
		     content[2], content[3]);
Packit Service a31ea6
	    buf[49] = 0;
Packit Service a31ea6
	    xmlEncodingErr(XML_I18N_CONV_FAILED,
Packit Service a31ea6
		    "input conversion failed due to input error, bytes %s\n",
Packit Service a31ea6
		           buf);
Packit Service a31ea6
        }
Packit Service a31ea6
    }
Packit Service a31ea6
    /*
Packit Service a31ea6
     * Ignore when input buffer is not on a boundary
Packit Service a31ea6
     */
Packit Service a31ea6
    if (ret == -3) ret = 0;
Packit Service a31ea6
    if (ret == -1) ret = 0;
Packit Service a31ea6
    return(ret);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
/**
Packit Service a31ea6
 * xmlCharEncInput:
Packit Service a31ea6
 * @input: a parser input buffer
Packit Service a31ea6
 * @flush: try to flush all the raw buffer
Packit Service a31ea6
 *
Packit Service a31ea6
 * Generic front-end for the encoding handler on parser input
Packit Service a31ea6
 *
Packit Service a31ea6
 * Returns the number of byte written if success, or
Packit Service a31ea6
 *     -1 general error
Packit Service a31ea6
 *     -2 if the transcoding fails (for *in is not valid utf8 string or
Packit Service a31ea6
 *        the result of transformation can't fit into the encoding we want), or
Packit Service a31ea6
 */
Packit Service a31ea6
int
Packit Service a31ea6
xmlCharEncInput(xmlParserInputBufferPtr input, int flush)
Packit Service a31ea6
{
Packit Service a31ea6
    int ret;
Packit Service a31ea6
    size_t written;
Packit Service a31ea6
    size_t toconv;
Packit Service a31ea6
    int c_in;
Packit Service a31ea6
    int c_out;
Packit Service a31ea6
    xmlBufPtr in;
Packit Service a31ea6
    xmlBufPtr out;
Packit Service a31ea6
Packit Service a31ea6
    if ((input == NULL) || (input->encoder == NULL) ||
Packit Service a31ea6
        (input->buffer == NULL) || (input->raw == NULL))
Packit Service a31ea6
        return (-1);
Packit Service a31ea6
    out = input->buffer;
Packit Service a31ea6
    in = input->raw;
Packit Service a31ea6
Packit Service a31ea6
    toconv = xmlBufUse(in);
Packit Service a31ea6
    if (toconv == 0)
Packit Service a31ea6
        return (0);
Packit Service a31ea6
    if ((toconv > 64 * 1024) && (flush == 0))
Packit Service a31ea6
        toconv = 64 * 1024;
Packit Service a31ea6
    written = xmlBufAvail(out);
Packit Service a31ea6
    if (written > 0)
Packit Service a31ea6
        written--; /* count '\0' */
Packit Service a31ea6
    if (toconv * 2 >= written) {
Packit Service a31ea6
        xmlBufGrow(out, toconv * 2);
Packit Service a31ea6
        written = xmlBufAvail(out);
Packit Service a31ea6
        if (written > 0)
Packit Service a31ea6
            written--; /* count '\0' */
Packit Service a31ea6
    }
Packit Service a31ea6
    if ((written > 128 * 1024) && (flush == 0))
Packit Service a31ea6
        written = 128 * 1024;
Packit Service a31ea6
Packit Service a31ea6
    c_in = toconv;
Packit Service a31ea6
    c_out = written;
Packit Service a31ea6
    ret = xmlEncInputChunk(input->encoder, xmlBufEnd(out), &c_out,
Packit Service a31ea6
                           xmlBufContent(in), &c_in);
Packit Service a31ea6
    xmlBufShrink(in, c_in);
Packit Service a31ea6
    xmlBufAddLen(out, c_out);
Packit Service a31ea6
    if (ret == -1)
Packit Service a31ea6
        ret = -3;
Packit Service a31ea6
Packit Service a31ea6
    switch (ret) {
Packit Service a31ea6
        case 0:
Packit Service a31ea6
#ifdef DEBUG_ENCODING
Packit Service a31ea6
            xmlGenericError(xmlGenericErrorContext,
Packit Service a31ea6
                            "converted %d bytes to %d bytes of input\n",
Packit Service a31ea6
                            c_in, c_out);
Packit Service a31ea6
#endif
Packit Service a31ea6
            break;
Packit Service a31ea6
        case -1:
Packit Service a31ea6
#ifdef DEBUG_ENCODING
Packit Service a31ea6
            xmlGenericError(xmlGenericErrorContext,
Packit Service a31ea6
                         "converted %d bytes to %d bytes of input, %d left\n",
Packit Service a31ea6
                            c_in, c_out, (int)xmlBufUse(in));
Packit Service a31ea6
#endif
Packit Service a31ea6
            break;
Packit Service a31ea6
        case -3:
Packit Service a31ea6
#ifdef DEBUG_ENCODING
Packit Service a31ea6
            xmlGenericError(xmlGenericErrorContext,
Packit Service a31ea6
                        "converted %d bytes to %d bytes of input, %d left\n",
Packit Service a31ea6
                            c_in, c_out, (int)xmlBufUse(in));
Packit Service a31ea6
#endif
Packit Service a31ea6
            break;
Packit Service a31ea6
        case -2: {
Packit Service a31ea6
            char buf[50];
Packit Service a31ea6
            const xmlChar *content = xmlBufContent(in);
Packit Service a31ea6
Packit Service a31ea6
	    snprintf(&buf[0], 49, "0x%02X 0x%02X 0x%02X 0x%02X",
Packit Service a31ea6
		     content[0], content[1],
Packit Service a31ea6
		     content[2], content[3]);
Packit Service a31ea6
	    buf[49] = 0;
Packit Service a31ea6
	    xmlEncodingErr(XML_I18N_CONV_FAILED,
Packit Service a31ea6
		    "input conversion failed due to input error, bytes %s\n",
Packit Service a31ea6
		           buf);
Packit Service a31ea6
        }
Packit Service a31ea6
    }
Packit Service a31ea6
    /*
Packit Service a31ea6
     * Ignore when input buffer is not on a boundary
Packit Service a31ea6
     */
Packit Service a31ea6
    if (ret == -3)
Packit Service a31ea6
        ret = 0;
Packit Service a31ea6
    return (c_out? c_out : ret);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
/**
Packit Service a31ea6
 * xmlCharEncInFunc:
Packit Service a31ea6
 * @handler:	char encoding transformation data structure
Packit Service a31ea6
 * @out:  an xmlBuffer for the output.
Packit Service a31ea6
 * @in:  an xmlBuffer for the input
Packit Service a31ea6
 *
Packit Service a31ea6
 * Generic front-end for the encoding handler input function
Packit Service a31ea6
 *
Packit Service a31ea6
 * Returns the number of byte written if success, or
Packit Service a31ea6
 *     -1 general error
Packit Service a31ea6
 *     -2 if the transcoding fails (for *in is not valid utf8 string or
Packit Service a31ea6
 *        the result of transformation can't fit into the encoding we want), or
Packit Service a31ea6
 */
Packit Service a31ea6
int
Packit Service a31ea6
xmlCharEncInFunc(xmlCharEncodingHandler * handler, xmlBufferPtr out,
Packit Service a31ea6
                 xmlBufferPtr in)
Packit Service a31ea6
{
Packit Service a31ea6
    int ret;
Packit Service a31ea6
    int written;
Packit Service a31ea6
    int toconv;
Packit Service a31ea6
Packit Service a31ea6
    if (handler == NULL)
Packit Service a31ea6
        return (-1);
Packit Service a31ea6
    if (out == NULL)
Packit Service a31ea6
        return (-1);
Packit Service a31ea6
    if (in == NULL)
Packit Service a31ea6
        return (-1);
Packit Service a31ea6
Packit Service a31ea6
    toconv = in->use;
Packit Service a31ea6
    if (toconv == 0)
Packit Service a31ea6
        return (0);
Packit Service a31ea6
    written = out->size - out->use -1; /* count '\0' */
Packit Service a31ea6
    if (toconv * 2 >= written) {
Packit Service a31ea6
        xmlBufferGrow(out, out->size + toconv * 2);
Packit Service a31ea6
        written = out->size - out->use - 1;
Packit Service a31ea6
    }
Packit Service a31ea6
    ret = xmlEncInputChunk(handler, &out->content[out->use], &written,
Packit Service a31ea6
                           in->content, &toconv);
Packit Service a31ea6
    xmlBufferShrink(in, toconv);
Packit Service a31ea6
    out->use += written;
Packit Service a31ea6
    out->content[out->use] = 0;
Packit Service a31ea6
    if (ret == -1)
Packit Service a31ea6
        ret = -3;
Packit Service a31ea6
Packit Service a31ea6
    switch (ret) {
Packit Service a31ea6
        case 0:
Packit Service a31ea6
#ifdef DEBUG_ENCODING
Packit Service a31ea6
            xmlGenericError(xmlGenericErrorContext,
Packit Service a31ea6
                            "converted %d bytes to %d bytes of input\n",
Packit Service a31ea6
                            toconv, written);
Packit Service a31ea6
#endif
Packit Service a31ea6
            break;
Packit Service a31ea6
        case -1:
Packit Service a31ea6
#ifdef DEBUG_ENCODING
Packit Service a31ea6
            xmlGenericError(xmlGenericErrorContext,
Packit Service a31ea6
                         "converted %d bytes to %d bytes of input, %d left\n",
Packit Service a31ea6
                            toconv, written, in->use);
Packit Service a31ea6
#endif
Packit Service a31ea6
            break;
Packit Service a31ea6
        case -3:
Packit Service a31ea6
#ifdef DEBUG_ENCODING
Packit Service a31ea6
            xmlGenericError(xmlGenericErrorContext,
Packit Service a31ea6
                        "converted %d bytes to %d bytes of input, %d left\n",
Packit Service a31ea6
                            toconv, written, in->use);
Packit Service a31ea6
#endif
Packit Service a31ea6
            break;
Packit Service a31ea6
        case -2: {
Packit Service a31ea6
            char buf[50];
Packit Service a31ea6
Packit Service a31ea6
	    snprintf(&buf[0], 49, "0x%02X 0x%02X 0x%02X 0x%02X",
Packit Service a31ea6
		     in->content[0], in->content[1],
Packit Service a31ea6
		     in->content[2], in->content[3]);
Packit Service a31ea6
	    buf[49] = 0;
Packit Service a31ea6
	    xmlEncodingErr(XML_I18N_CONV_FAILED,
Packit Service a31ea6
		    "input conversion failed due to input error, bytes %s\n",
Packit Service a31ea6
		           buf);
Packit Service a31ea6
        }
Packit Service a31ea6
    }
Packit Service a31ea6
    /*
Packit Service a31ea6
     * Ignore when input buffer is not on a boundary
Packit Service a31ea6
     */
Packit Service a31ea6
    if (ret == -3)
Packit Service a31ea6
        ret = 0;
Packit Service a31ea6
    return (written? written : ret);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
#ifdef LIBXML_OUTPUT_ENABLED
Packit Service a31ea6
/**
Packit Service a31ea6
 * xmlCharEncOutput:
Packit Service a31ea6
 * @output: a parser output buffer
Packit Service a31ea6
 * @init: is this an initialization call without data
Packit Service a31ea6
 *
Packit Service a31ea6
 * Generic front-end for the encoding handler on parser output
Packit Service a31ea6
 * a first call with @init == 1 has to be made first to initiate the
Packit Service a31ea6
 * output in case of non-stateless encoding needing to initiate their
Packit Service a31ea6
 * state or the output (like the BOM in UTF16).
Packit Service a31ea6
 * In case of UTF8 sequence conversion errors for the given encoder,
Packit Service a31ea6
 * the content will be automatically remapped to a CharRef sequence.
Packit Service a31ea6
 *
Packit Service a31ea6
 * Returns the number of byte written if success, or
Packit Service a31ea6
 *     -1 general error
Packit Service a31ea6
 *     -2 if the transcoding fails (for *in is not valid utf8 string or
Packit Service a31ea6
 *        the result of transformation can't fit into the encoding we want), or
Packit Service a31ea6
 */
Packit Service a31ea6
int
Packit Service a31ea6
xmlCharEncOutput(xmlOutputBufferPtr output, int init)
Packit Service a31ea6
{
Packit Service a31ea6
    int ret;
Packit Service a31ea6
    size_t written;
Packit Service a31ea6
    size_t writtentot = 0;
Packit Service a31ea6
    size_t toconv;
Packit Service a31ea6
    int c_in;
Packit Service a31ea6
    int c_out;
Packit Service a31ea6
    xmlBufPtr in;
Packit Service a31ea6
    xmlBufPtr out;
Packit Service a31ea6
Packit Service a31ea6
    if ((output == NULL) || (output->encoder == NULL) ||
Packit Service a31ea6
        (output->buffer == NULL) || (output->conv == NULL))
Packit Service a31ea6
        return (-1);
Packit Service a31ea6
    out = output->conv;
Packit Service a31ea6
    in = output->buffer;
Packit Service a31ea6
Packit Service a31ea6
retry:
Packit Service a31ea6
Packit Service a31ea6
    written = xmlBufAvail(out);
Packit Service a31ea6
    if (written > 0)
Packit Service a31ea6
        written--; /* count '\0' */
Packit Service a31ea6
Packit Service a31ea6
    /*
Packit Service a31ea6
     * First specific handling of the initialization call
Packit Service a31ea6
     */
Packit Service a31ea6
    if (init) {
Packit Service a31ea6
        c_in = 0;
Packit Service a31ea6
        c_out = written;
Packit Service a31ea6
        /* TODO: Check return value. */
Packit Service a31ea6
        xmlEncOutputChunk(output->encoder, xmlBufEnd(out), &c_out,
Packit Service a31ea6
                          NULL, &c_in);
Packit Service a31ea6
        xmlBufAddLen(out, c_out);
Packit Service a31ea6
#ifdef DEBUG_ENCODING
Packit Service a31ea6
	xmlGenericError(xmlGenericErrorContext,
Packit Service a31ea6
		"initialized encoder\n");
Packit Service a31ea6
#endif
Packit Service a31ea6
        return(0);
Packit Service a31ea6
    }
Packit Service a31ea6
Packit Service a31ea6
    /*
Packit Service a31ea6
     * Conversion itself.
Packit Service a31ea6
     */
Packit Service a31ea6
    toconv = xmlBufUse(in);
Packit Service a31ea6
    if (toconv == 0)
Packit Service a31ea6
        return (0);
Packit Service a31ea6
    if (toconv > 64 * 1024)
Packit Service a31ea6
        toconv = 64 * 1024;
Packit Service a31ea6
    if (toconv * 4 >= written) {
Packit Service a31ea6
        xmlBufGrow(out, toconv * 4);
Packit Service a31ea6
        written = xmlBufAvail(out) - 1;
Packit Service a31ea6
    }
Packit Service a31ea6
    if (written > 256 * 1024)
Packit Service a31ea6
        written = 256 * 1024;
Packit Service a31ea6
Packit Service a31ea6
    c_in = toconv;
Packit Service a31ea6
    c_out = written;
Packit Service a31ea6
    ret = xmlEncOutputChunk(output->encoder, xmlBufEnd(out), &c_out,
Packit Service a31ea6
                            xmlBufContent(in), &c_in);
Packit Service a31ea6
    xmlBufShrink(in, c_in);
Packit Service a31ea6
    xmlBufAddLen(out, c_out);
Packit Service a31ea6
    writtentot += c_out;
Packit Service a31ea6
    if (ret == -1) {
Packit Service a31ea6
        if (c_out > 0) {
Packit Service a31ea6
            /* Can be a limitation of iconv or uconv */
Packit Service a31ea6
            goto retry;
Packit Service a31ea6
        }
Packit Service a31ea6
        ret = -3;
Packit Service a31ea6
    }
Packit Service a31ea6
Packit Service a31ea6
    if (ret >= 0) output += ret;
Packit Service a31ea6
Packit Service a31ea6
    /*
Packit Service a31ea6
     * Attempt to handle error cases
Packit Service a31ea6
     */
Packit Service a31ea6
    switch (ret) {
Packit Service a31ea6
        case 0:
Packit Service a31ea6
#ifdef DEBUG_ENCODING
Packit Service a31ea6
	    xmlGenericError(xmlGenericErrorContext,
Packit Service a31ea6
		    "converted %d bytes to %d bytes of output\n",
Packit Service a31ea6
	            c_in, c_out);
Packit Service a31ea6
#endif
Packit Service a31ea6
	    break;
Packit Service a31ea6
        case -1:
Packit Service a31ea6
#ifdef DEBUG_ENCODING
Packit Service a31ea6
	    xmlGenericError(xmlGenericErrorContext,
Packit Service a31ea6
		    "output conversion failed by lack of space\n");
Packit Service a31ea6
#endif
Packit Service a31ea6
	    break;
Packit Service a31ea6
        case -3:
Packit Service a31ea6
#ifdef DEBUG_ENCODING
Packit Service a31ea6
	    xmlGenericError(xmlGenericErrorContext,"converted %d bytes to %d bytes of output %d left\n",
Packit Service a31ea6
	            c_in, c_out, (int) xmlBufUse(in));
Packit Service a31ea6
#endif
Packit Service a31ea6
	    break;
Packit Service a31ea6
        case -4:
Packit Service a31ea6
            xmlEncodingErr(XML_I18N_NO_OUTPUT,
Packit Service a31ea6
                           "xmlCharEncOutFunc: no output function !\n", NULL);
Packit Service a31ea6
            ret = -1;
Packit Service a31ea6
            break;
Packit Service a31ea6
        case -2: {
Packit Service a31ea6
	    xmlChar charref[20];
Packit Service a31ea6
	    int len = (int) xmlBufUse(in);
Packit Service a31ea6
            xmlChar *content = xmlBufContent(in);
Packit Service a31ea6
	    int cur, charrefLen;
Packit Service a31ea6
Packit Service a31ea6
	    cur = xmlGetUTF8Char(content, &len;;
Packit Service a31ea6
	    if (cur <= 0)
Packit Service a31ea6
                break;
Packit Service a31ea6
Packit Service a31ea6
#ifdef DEBUG_ENCODING
Packit Service a31ea6
            xmlGenericError(xmlGenericErrorContext,
Packit Service a31ea6
                    "handling output conversion error\n");
Packit Service a31ea6
            xmlGenericError(xmlGenericErrorContext,
Packit Service a31ea6
                    "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n",
Packit Service a31ea6
                    content[0], content[1],
Packit Service a31ea6
                    content[2], content[3]);
Packit Service a31ea6
#endif
Packit Service a31ea6
            /*
Packit Service a31ea6
             * Removes the UTF8 sequence, and replace it by a charref
Packit Service a31ea6
             * and continue the transcoding phase, hoping the error
Packit Service a31ea6
             * did not mangle the encoder state.
Packit Service a31ea6
             */
Packit Service a31ea6
            charrefLen = snprintf((char *) &charref[0], sizeof(charref),
Packit Service a31ea6
                             "&#%d;", cur);
Packit Service a31ea6
            xmlBufShrink(in, len);
Packit Service a31ea6
            xmlBufGrow(out, charrefLen * 4);
Packit Service a31ea6
            c_out = xmlBufAvail(out) - 1;
Packit Service a31ea6
            c_in = charrefLen;
Packit Service a31ea6
            ret = xmlEncOutputChunk(output->encoder, xmlBufEnd(out), &c_out,
Packit Service a31ea6
                                    charref, &c_in);
Packit Service a31ea6
Packit Service a31ea6
	    if ((ret < 0) || (c_in != charrefLen)) {
Packit Service a31ea6
		char buf[50];
Packit Service a31ea6
Packit Service a31ea6
		snprintf(&buf[0], 49, "0x%02X 0x%02X 0x%02X 0x%02X",
Packit Service a31ea6
			 content[0], content[1],
Packit Service a31ea6
			 content[2], content[3]);
Packit Service a31ea6
		buf[49] = 0;
Packit Service a31ea6
		xmlEncodingErr(XML_I18N_CONV_FAILED,
Packit Service a31ea6
		    "output conversion failed due to conv error, bytes %s\n",
Packit Service a31ea6
			       buf);
Packit Service a31ea6
		if (xmlBufGetAllocationScheme(in) != XML_BUFFER_ALLOC_IMMUTABLE)
Packit Service a31ea6
		    content[0] = ' ';
Packit Service a31ea6
                break;
Packit Service a31ea6
	    }
Packit Service a31ea6
Packit Service a31ea6
            xmlBufAddLen(out, c_out);
Packit Service a31ea6
            writtentot += c_out;
Packit Service a31ea6
            goto retry;
Packit Service a31ea6
	}
Packit Service a31ea6
    }
Packit Service a31ea6
    return(ret);
Packit Service a31ea6
}
Packit Service a31ea6
#endif
Packit Service a31ea6
Packit Service a31ea6
/**
Packit Service a31ea6
 * xmlCharEncOutFunc:
Packit Service a31ea6
 * @handler:	char enconding transformation data structure
Packit Service a31ea6
 * @out:  an xmlBuffer for the output.
Packit Service a31ea6
 * @in:  an xmlBuffer for the input
Packit Service a31ea6
 *
Packit Service a31ea6
 * Generic front-end for the encoding handler output function
Packit Service a31ea6
 * a first call with @in == NULL has to be made firs to initiate the
Packit Service a31ea6
 * output in case of non-stateless encoding needing to initiate their
Packit Service a31ea6
 * state or the output (like the BOM in UTF16).
Packit Service a31ea6
 * In case of UTF8 sequence conversion errors for the given encoder,
Packit Service a31ea6
 * the content will be automatically remapped to a CharRef sequence.
Packit Service a31ea6
 *
Packit Service a31ea6
 * Returns the number of byte written if success, or
Packit Service a31ea6
 *     -1 general error
Packit Service a31ea6
 *     -2 if the transcoding fails (for *in is not valid utf8 string or
Packit Service a31ea6
 *        the result of transformation can't fit into the encoding we want), or
Packit Service a31ea6
 */
Packit Service a31ea6
int
Packit Service a31ea6
xmlCharEncOutFunc(xmlCharEncodingHandler *handler, xmlBufferPtr out,
Packit Service a31ea6
                  xmlBufferPtr in) {
Packit Service a31ea6
    int ret;
Packit Service a31ea6
    int written;
Packit Service a31ea6
    int writtentot = 0;
Packit Service a31ea6
    int toconv;
Packit Service a31ea6
    int output = 0;
Packit Service a31ea6
Packit Service a31ea6
    if (handler == NULL) return(-1);
Packit Service a31ea6
    if (out == NULL) return(-1);
Packit Service a31ea6
Packit Service a31ea6
retry:
Packit Service a31ea6
Packit Service a31ea6
    written = out->size - out->use;
Packit Service a31ea6
Packit Service a31ea6
    if (written > 0)
Packit Service a31ea6
	written--; /* Gennady: count '/0' */
Packit Service a31ea6
Packit Service a31ea6
    /*
Packit Service a31ea6
     * First specific handling of in = NULL, i.e. the initialization call
Packit Service a31ea6
     */
Packit Service a31ea6
    if (in == NULL) {
Packit Service a31ea6
        toconv = 0;
Packit Service a31ea6
        /* TODO: Check return value. */
Packit Service a31ea6
        xmlEncOutputChunk(handler, &out->content[out->use], &written,
Packit Service a31ea6
                          NULL, &toconv);
Packit Service a31ea6
        out->use += written;
Packit Service a31ea6
        out->content[out->use] = 0;
Packit Service a31ea6
#ifdef DEBUG_ENCODING
Packit Service a31ea6
	xmlGenericError(xmlGenericErrorContext,
Packit Service a31ea6
		"initialized encoder\n");
Packit Service a31ea6
#endif
Packit Service a31ea6
        return(0);
Packit Service a31ea6
    }
Packit Service a31ea6
Packit Service a31ea6
    /*
Packit Service a31ea6
     * Conversion itself.
Packit Service a31ea6
     */
Packit Service a31ea6
    toconv = in->use;
Packit Service a31ea6
    if (toconv == 0)
Packit Service a31ea6
	return(0);
Packit Service a31ea6
    if (toconv * 4 >= written) {
Packit Service a31ea6
        xmlBufferGrow(out, toconv * 4);
Packit Service a31ea6
	written = out->size - out->use - 1;
Packit Service a31ea6
    }
Packit Service a31ea6
    ret = xmlEncOutputChunk(handler, &out->content[out->use], &written,
Packit Service a31ea6
                            in->content, &toconv);
Packit Service a31ea6
    xmlBufferShrink(in, toconv);
Packit Service a31ea6
    out->use += written;
Packit Service a31ea6
    writtentot += written;
Packit Service a31ea6
    out->content[out->use] = 0;
Packit Service a31ea6
    if (ret == -1) {
Packit Service a31ea6
        if (written > 0) {
Packit Service a31ea6
            /* Can be a limitation of iconv or uconv */
Packit Service a31ea6
            goto retry;
Packit Service a31ea6
        }
Packit Service a31ea6
        ret = -3;
Packit Service a31ea6
    }
Packit Service a31ea6
Packit Service a31ea6
    if (ret >= 0) output += ret;
Packit Service a31ea6
Packit Service a31ea6
    /*
Packit Service a31ea6
     * Attempt to handle error cases
Packit Service a31ea6
     */
Packit Service a31ea6
    switch (ret) {
Packit Service a31ea6
        case 0:
Packit Service a31ea6
#ifdef DEBUG_ENCODING
Packit Service a31ea6
	    xmlGenericError(xmlGenericErrorContext,
Packit Service a31ea6
		    "converted %d bytes to %d bytes of output\n",
Packit Service a31ea6
	            toconv, written);
Packit Service a31ea6
#endif
Packit Service a31ea6
	    break;
Packit Service a31ea6
        case -1:
Packit Service a31ea6
#ifdef DEBUG_ENCODING
Packit Service a31ea6
	    xmlGenericError(xmlGenericErrorContext,
Packit Service a31ea6
		    "output conversion failed by lack of space\n");
Packit Service a31ea6
#endif
Packit Service a31ea6
	    break;
Packit Service a31ea6
        case -3:
Packit Service a31ea6
#ifdef DEBUG_ENCODING
Packit Service a31ea6
	    xmlGenericError(xmlGenericErrorContext,"converted %d bytes to %d bytes of output %d left\n",
Packit Service a31ea6
	            toconv, written, in->use);
Packit Service a31ea6
#endif
Packit Service a31ea6
	    break;
Packit Service a31ea6
        case -4:
Packit Service a31ea6
	    xmlEncodingErr(XML_I18N_NO_OUTPUT,
Packit Service a31ea6
		           "xmlCharEncOutFunc: no output function !\n", NULL);
Packit Service a31ea6
	    ret = -1;
Packit Service a31ea6
            break;
Packit Service a31ea6
        case -2: {
Packit Service a31ea6
	    xmlChar charref[20];
Packit Service a31ea6
	    int len = in->use;
Packit Service a31ea6
	    const xmlChar *utf = (const xmlChar *) in->content;
Packit Service a31ea6
	    int cur, charrefLen;
Packit Service a31ea6
Packit Service a31ea6
	    cur = xmlGetUTF8Char(utf, &len;;
Packit Service a31ea6
	    if (cur <= 0)
Packit Service a31ea6
                break;
Packit Service a31ea6
Packit Service a31ea6
#ifdef DEBUG_ENCODING
Packit Service a31ea6
            xmlGenericError(xmlGenericErrorContext,
Packit Service a31ea6
                    "handling output conversion error\n");
Packit Service a31ea6
            xmlGenericError(xmlGenericErrorContext,
Packit Service a31ea6
                    "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n",
Packit Service a31ea6
                    in->content[0], in->content[1],
Packit Service a31ea6
                    in->content[2], in->content[3]);
Packit Service a31ea6
#endif
Packit Service a31ea6
            /*
Packit Service a31ea6
             * Removes the UTF8 sequence, and replace it by a charref
Packit Service a31ea6
             * and continue the transcoding phase, hoping the error
Packit Service a31ea6
             * did not mangle the encoder state.
Packit Service a31ea6
             */
Packit Service a31ea6
            charrefLen = snprintf((char *) &charref[0], sizeof(charref),
Packit Service a31ea6
                             "&#%d;", cur);
Packit Service a31ea6
            xmlBufferShrink(in, len);
Packit Service a31ea6
            xmlBufferGrow(out, charrefLen * 4);
Packit Service a31ea6
	    written = out->size - out->use - 1;
Packit Service a31ea6
            toconv = charrefLen;
Packit Service a31ea6
            ret = xmlEncOutputChunk(handler, &out->content[out->use], &written,
Packit Service a31ea6
                                    charref, &toconv);
Packit Service a31ea6
Packit Service a31ea6
	    if ((ret < 0) || (toconv != charrefLen)) {
Packit Service a31ea6
		char buf[50];
Packit Service a31ea6
Packit Service a31ea6
		snprintf(&buf[0], 49, "0x%02X 0x%02X 0x%02X 0x%02X",
Packit Service a31ea6
			 in->content[0], in->content[1],
Packit Service a31ea6
			 in->content[2], in->content[3]);
Packit Service a31ea6
		buf[49] = 0;
Packit Service a31ea6
		xmlEncodingErr(XML_I18N_CONV_FAILED,
Packit Service a31ea6
		    "output conversion failed due to conv error, bytes %s\n",
Packit Service a31ea6
			       buf);
Packit Service a31ea6
		if (in->alloc != XML_BUFFER_ALLOC_IMMUTABLE)
Packit Service a31ea6
		    in->content[0] = ' ';
Packit Service a31ea6
	        break;
Packit Service a31ea6
	    }
Packit Service a31ea6
Packit Service a31ea6
            out->use += written;
Packit Service a31ea6
            writtentot += written;
Packit Service a31ea6
            out->content[out->use] = 0;
Packit Service a31ea6
            goto retry;
Packit Service a31ea6
	}
Packit Service a31ea6
    }
Packit Service a31ea6
    return(ret);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
/**
Packit Service a31ea6
 * xmlCharEncCloseFunc:
Packit Service a31ea6
 * @handler:	char enconding transformation data structure
Packit Service a31ea6
 *
Packit Service a31ea6
 * Generic front-end for encoding handler close function
Packit Service a31ea6
 *
Packit Service a31ea6
 * Returns 0 if success, or -1 in case of error
Packit Service a31ea6
 */
Packit Service a31ea6
int
Packit Service a31ea6
xmlCharEncCloseFunc(xmlCharEncodingHandler *handler) {
Packit Service a31ea6
    int ret = 0;
Packit Service a31ea6
    int tofree = 0;
Packit Service a31ea6
    int i, handler_in_list = 0;
Packit Service a31ea6
Packit Service a31ea6
    if (handler == NULL) return(-1);
Packit Service a31ea6
    if (handler->name == NULL) return(-1);
Packit Service a31ea6
    if (handlers != NULL) {
Packit Service a31ea6
        for (i = 0;i < nbCharEncodingHandler; i++) {
Packit Service a31ea6
            if (handler == handlers[i]) {
Packit Service a31ea6
	        handler_in_list = 1;
Packit Service a31ea6
		break;
Packit Service a31ea6
	    }
Packit Service a31ea6
	}
Packit Service a31ea6
    }
Packit Service a31ea6
#ifdef LIBXML_ICONV_ENABLED
Packit Service a31ea6
    /*
Packit Service a31ea6
     * Iconv handlers can be used only once, free the whole block.
Packit Service a31ea6
     * and the associated icon resources.
Packit Service a31ea6
     */
Packit Service a31ea6
    if ((handler_in_list == 0) &&
Packit Service a31ea6
        ((handler->iconv_out != NULL) || (handler->iconv_in != NULL))) {
Packit Service a31ea6
        tofree = 1;
Packit Service a31ea6
	if (handler->iconv_out != NULL) {
Packit Service a31ea6
	    if (iconv_close(handler->iconv_out))
Packit Service a31ea6
		ret = -1;
Packit Service a31ea6
	    handler->iconv_out = NULL;
Packit Service a31ea6
	}
Packit Service a31ea6
	if (handler->iconv_in != NULL) {
Packit Service a31ea6
	    if (iconv_close(handler->iconv_in))
Packit Service a31ea6
		ret = -1;
Packit Service a31ea6
	    handler->iconv_in = NULL;
Packit Service a31ea6
	}
Packit Service a31ea6
    }
Packit Service a31ea6
#endif /* LIBXML_ICONV_ENABLED */
Packit Service a31ea6
#ifdef LIBXML_ICU_ENABLED
Packit Service a31ea6
    if ((handler_in_list == 0) &&
Packit Service a31ea6
        ((handler->uconv_out != NULL) || (handler->uconv_in != NULL))) {
Packit Service a31ea6
        tofree = 1;
Packit Service a31ea6
	if (handler->uconv_out != NULL) {
Packit Service a31ea6
	    closeIcuConverter(handler->uconv_out);
Packit Service a31ea6
	    handler->uconv_out = NULL;
Packit Service a31ea6
	}
Packit Service a31ea6
	if (handler->uconv_in != NULL) {
Packit Service a31ea6
	    closeIcuConverter(handler->uconv_in);
Packit Service a31ea6
	    handler->uconv_in = NULL;
Packit Service a31ea6
	}
Packit Service a31ea6
    }
Packit Service a31ea6
#endif
Packit Service a31ea6
    if (tofree) {
Packit Service a31ea6
        /* free up only dynamic handlers iconv/uconv */
Packit Service a31ea6
        if (handler->name != NULL)
Packit Service a31ea6
            xmlFree(handler->name);
Packit Service a31ea6
        handler->name = NULL;
Packit Service a31ea6
        xmlFree(handler);
Packit Service a31ea6
    }
Packit Service a31ea6
#ifdef DEBUG_ENCODING
Packit Service a31ea6
    if (ret)
Packit Service a31ea6
        xmlGenericError(xmlGenericErrorContext,
Packit Service a31ea6
		"failed to close the encoding handler\n");
Packit Service a31ea6
    else
Packit Service a31ea6
        xmlGenericError(xmlGenericErrorContext,
Packit Service a31ea6
		"closed the encoding handler\n");
Packit Service a31ea6
#endif
Packit Service a31ea6
Packit Service a31ea6
    return(ret);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
/**
Packit Service a31ea6
 * xmlByteConsumed:
Packit Service a31ea6
 * @ctxt: an XML parser context
Packit Service a31ea6
 *
Packit Service a31ea6
 * This function provides the current index of the parser relative
Packit Service a31ea6
 * to the start of the current entity. This function is computed in
Packit Service a31ea6
 * bytes from the beginning starting at zero and finishing at the
Packit Service a31ea6
 * size in byte of the file if parsing a file. The function is
Packit Service a31ea6
 * of constant cost if the input is UTF-8 but can be costly if run
Packit Service a31ea6
 * on non-UTF-8 input.
Packit Service a31ea6
 *
Packit Service a31ea6
 * Returns the index in bytes from the beginning of the entity or -1
Packit Service a31ea6
 *         in case the index could not be computed.
Packit Service a31ea6
 */
Packit Service a31ea6
long
Packit Service a31ea6
xmlByteConsumed(xmlParserCtxtPtr ctxt) {
Packit Service a31ea6
    xmlParserInputPtr in;
Packit Service a31ea6
Packit Service a31ea6
    if (ctxt == NULL) return(-1);
Packit Service a31ea6
    in = ctxt->input;
Packit Service a31ea6
    if (in == NULL)  return(-1);
Packit Service a31ea6
    if ((in->buf != NULL) && (in->buf->encoder != NULL)) {
Packit Service a31ea6
        unsigned int unused = 0;
Packit Service a31ea6
	xmlCharEncodingHandler * handler = in->buf->encoder;
Packit Service a31ea6
        /*
Packit Service a31ea6
	 * Encoding conversion, compute the number of unused original
Packit Service a31ea6
	 * bytes from the input not consumed and substract that from
Packit Service a31ea6
	 * the raw consumed value, this is not a cheap operation
Packit Service a31ea6
	 */
Packit Service a31ea6
        if (in->end - in->cur > 0) {
Packit Service a31ea6
	    unsigned char convbuf[32000];
Packit Service a31ea6
	    const unsigned char *cur = (const unsigned char *)in->cur;
Packit Service a31ea6
	    int toconv = in->end - in->cur, written = 32000;
Packit Service a31ea6
Packit Service a31ea6
	    int ret;
Packit Service a31ea6
Packit Service a31ea6
            do {
Packit Service a31ea6
                toconv = in->end - cur;
Packit Service a31ea6
                written = 32000;
Packit Service a31ea6
                ret = xmlEncOutputChunk(handler, &convbuf[0], &written,
Packit Service a31ea6
                                        cur, &toconv);
Packit Service a31ea6
                if (ret < 0) {
Packit Service a31ea6
                    if (written > 0)
Packit Service a31ea6
                        ret = -2;
Packit Service a31ea6
                    else
Packit Service a31ea6
                        return(-1);
Packit Service a31ea6
                }
Packit Service a31ea6
                unused += written;
Packit Service a31ea6
                cur += toconv;
Packit Service a31ea6
            } while (ret == -2);
Packit Service a31ea6
	}
Packit Service a31ea6
	if (in->buf->rawconsumed < unused)
Packit Service a31ea6
	    return(-1);
Packit Service a31ea6
	return(in->buf->rawconsumed - unused);
Packit Service a31ea6
    }
Packit Service a31ea6
    return(in->consumed + (in->cur - in->base));
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
#if !defined(LIBXML_ICONV_ENABLED) && !defined(LIBXML_ICU_ENABLED)
Packit Service a31ea6
#ifdef LIBXML_ISO8859X_ENABLED
Packit Service a31ea6
Packit Service a31ea6
/**
Packit Service a31ea6
 * UTF8ToISO8859x:
Packit Service a31ea6
 * @out:  a pointer to an array of bytes to store the result
Packit Service a31ea6
 * @outlen:  the length of @out
Packit Service a31ea6
 * @in:  a pointer to an array of UTF-8 chars
Packit Service a31ea6
 * @inlen:  the length of @in
Packit Service a31ea6
 * @xlattable: the 2-level transcoding table
Packit Service a31ea6
 *
Packit Service a31ea6
 * Take a block of UTF-8 chars in and try to convert it to an ISO 8859-*
Packit Service a31ea6
 * block of chars out.
Packit Service a31ea6
 *
Packit Service a31ea6
 * Returns 0 if success, -2 if the transcoding fails, or -1 otherwise
Packit Service a31ea6
 * The value of @inlen after return is the number of octets consumed
Packit Service a31ea6
 *     as the return value is positive, else unpredictable.
Packit Service a31ea6
 * The value of @outlen after return is the number of ocetes consumed.
Packit Service a31ea6
 */
Packit Service a31ea6
static int
Packit Service a31ea6
UTF8ToISO8859x(unsigned char* out, int *outlen,
Packit Service a31ea6
              const unsigned char* in, int *inlen,
Packit Service a31ea6
              unsigned char const *xlattable) {
Packit Service a31ea6
    const unsigned char* outstart = out;
Packit Service a31ea6
    const unsigned char* inend;
Packit Service a31ea6
    const unsigned char* instart = in;
Packit Service a31ea6
    const unsigned char* processed = in;
Packit Service a31ea6
Packit Service a31ea6
    if ((out == NULL) || (outlen == NULL) || (inlen == NULL) ||
Packit Service a31ea6
        (xlattable == NULL))
Packit Service a31ea6
	return(-1);
Packit Service a31ea6
    if (in == NULL) {
Packit Service a31ea6
        /*
Packit Service a31ea6
        * initialization nothing to do
Packit Service a31ea6
        */
Packit Service a31ea6
        *outlen = 0;
Packit Service a31ea6
        *inlen = 0;
Packit Service a31ea6
        return(0);
Packit Service a31ea6
    }
Packit Service a31ea6
    inend = in + (*inlen);
Packit Service a31ea6
    while (in < inend) {
Packit Service a31ea6
        unsigned char d = *in++;
Packit Service a31ea6
        if  (d < 0x80)  {
Packit Service a31ea6
            *out++ = d;
Packit Service a31ea6
        } else if (d < 0xC0) {
Packit Service a31ea6
            /* trailing byte in leading position */
Packit Service a31ea6
            *outlen = out - outstart;
Packit Service a31ea6
            *inlen = processed - instart;
Packit Service a31ea6
            return(-2);
Packit Service a31ea6
        } else if (d < 0xE0) {
Packit Service a31ea6
            unsigned char c;
Packit Service a31ea6
            if (!(in < inend)) {
Packit Service a31ea6
                /* trailing byte not in input buffer */
Packit Service a31ea6
                *outlen = out - outstart;
Packit Service a31ea6
                *inlen = processed - instart;
Packit Service a31ea6
                return(-3);
Packit Service a31ea6
            }
Packit Service a31ea6
            c = *in++;
Packit Service a31ea6
            if ((c & 0xC0) != 0x80) {
Packit Service a31ea6
                /* not a trailing byte */
Packit Service a31ea6
                *outlen = out - outstart;
Packit Service a31ea6
                *inlen = processed - instart;
Packit Service a31ea6
                return(-2);
Packit Service a31ea6
            }
Packit Service a31ea6
            c = c & 0x3F;
Packit Service a31ea6
            d = d & 0x1F;
Packit Service a31ea6
            d = xlattable [48 + c + xlattable [d] * 64];
Packit Service a31ea6
            if (d == 0) {
Packit Service a31ea6
                /* not in character set */
Packit Service a31ea6
                *outlen = out - outstart;
Packit Service a31ea6
                *inlen = processed - instart;
Packit Service a31ea6
                return(-2);
Packit Service a31ea6
            }
Packit Service a31ea6
            *out++ = d;
Packit Service a31ea6
        } else if (d < 0xF0) {
Packit Service a31ea6
            unsigned char c1;
Packit Service a31ea6
            unsigned char c2;
Packit Service a31ea6
            if (!(in < inend - 1)) {
Packit Service a31ea6
                /* trailing bytes not in input buffer */
Packit Service a31ea6
                *outlen = out - outstart;
Packit Service a31ea6
                *inlen = processed - instart;
Packit Service a31ea6
                return(-3);
Packit Service a31ea6
            }
Packit Service a31ea6
            c1 = *in++;
Packit Service a31ea6
            if ((c1 & 0xC0) != 0x80) {
Packit Service a31ea6
                /* not a trailing byte (c1) */
Packit Service a31ea6
                *outlen = out - outstart;
Packit Service a31ea6
                *inlen = processed - instart;
Packit Service a31ea6
                return(-2);
Packit Service a31ea6
            }
Packit Service a31ea6
            c2 = *in++;
Packit Service a31ea6
            if ((c2 & 0xC0) != 0x80) {
Packit Service a31ea6
                /* not a trailing byte (c2) */
Packit Service a31ea6
                *outlen = out - outstart;
Packit Service a31ea6
                *inlen = processed - instart;
Packit Service a31ea6
                return(-2);
Packit Service a31ea6
            }
Packit Service a31ea6
            c1 = c1 & 0x3F;
Packit Service a31ea6
            c2 = c2 & 0x3F;
Packit Service a31ea6
	    d = d & 0x0F;
Packit Service a31ea6
	    d = xlattable [48 + c2 + xlattable [48 + c1 +
Packit Service a31ea6
			xlattable [32 + d] * 64] * 64];
Packit Service a31ea6
            if (d == 0) {
Packit Service a31ea6
                /* not in character set */
Packit Service a31ea6
                *outlen = out - outstart;
Packit Service a31ea6
                *inlen = processed - instart;
Packit Service a31ea6
                return(-2);
Packit Service a31ea6
            }
Packit Service a31ea6
            *out++ = d;
Packit Service a31ea6
        } else {
Packit Service a31ea6
            /* cannot transcode >= U+010000 */
Packit Service a31ea6
            *outlen = out - outstart;
Packit Service a31ea6
            *inlen = processed - instart;
Packit Service a31ea6
            return(-2);
Packit Service a31ea6
        }
Packit Service a31ea6
        processed = in;
Packit Service a31ea6
    }
Packit Service a31ea6
    *outlen = out - outstart;
Packit Service a31ea6
    *inlen = processed - instart;
Packit Service a31ea6
    return(*outlen);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
/**
Packit Service a31ea6
 * ISO8859xToUTF8
Packit Service a31ea6
 * @out:  a pointer to an array of bytes to store the result
Packit Service a31ea6
 * @outlen:  the length of @out
Packit Service a31ea6
 * @in:  a pointer to an array of ISO Latin 1 chars
Packit Service a31ea6
 * @inlen:  the length of @in
Packit Service a31ea6
 *
Packit Service a31ea6
 * Take a block of ISO 8859-* chars in and try to convert it to an UTF-8
Packit Service a31ea6
 * block of chars out.
Packit Service a31ea6
 * Returns 0 if success, or -1 otherwise
Packit Service a31ea6
 * The value of @inlen after return is the number of octets consumed
Packit Service a31ea6
 * The value of @outlen after return is the number of ocetes produced.
Packit Service a31ea6
 */
Packit Service a31ea6
static int
Packit Service a31ea6
ISO8859xToUTF8(unsigned char* out, int *outlen,
Packit Service a31ea6
              const unsigned char* in, int *inlen,
Packit Service a31ea6
              unsigned short const *unicodetable) {
Packit Service a31ea6
    unsigned char* outstart = out;
Packit Service a31ea6
    unsigned char* outend;
Packit Service a31ea6
    const unsigned char* instart = in;
Packit Service a31ea6
    const unsigned char* inend;
Packit Service a31ea6
    const unsigned char* instop;
Packit Service a31ea6
    unsigned int c;
Packit Service a31ea6
Packit Service a31ea6
    if ((out == NULL) || (outlen == NULL) || (inlen == NULL) ||
Packit Service a31ea6
        (in == NULL) || (unicodetable == NULL))
Packit Service a31ea6
	return(-1);
Packit Service a31ea6
    outend = out + *outlen;
Packit Service a31ea6
    inend = in + *inlen;
Packit Service a31ea6
    instop = inend;
Packit Service a31ea6
Packit Service a31ea6
    while ((in < inend) && (out < outend - 2)) {
Packit Service a31ea6
        if (*in >= 0x80) {
Packit Service a31ea6
            c = unicodetable [*in - 0x80];
Packit Service a31ea6
            if (c == 0) {
Packit Service a31ea6
                /* undefined code point */
Packit Service a31ea6
                *outlen = out - outstart;
Packit Service a31ea6
                *inlen = in - instart;
Packit Service a31ea6
                return (-1);
Packit Service a31ea6
            }
Packit Service a31ea6
            if (c < 0x800) {
Packit Service a31ea6
                *out++ = ((c >>  6) & 0x1F) | 0xC0;
Packit Service a31ea6
                *out++ = (c & 0x3F) | 0x80;
Packit Service a31ea6
            } else {
Packit Service a31ea6
                *out++ = ((c >>  12) & 0x0F) | 0xE0;
Packit Service a31ea6
                *out++ = ((c >>  6) & 0x3F) | 0x80;
Packit Service a31ea6
                *out++ = (c & 0x3F) | 0x80;
Packit Service a31ea6
            }
Packit Service a31ea6
            ++in;
Packit Service a31ea6
        }
Packit Service a31ea6
        if (instop - in > outend - out) instop = in + (outend - out);
Packit Service a31ea6
        while ((*in < 0x80) && (in < instop)) {
Packit Service a31ea6
            *out++ = *in++;
Packit Service a31ea6
        }
Packit Service a31ea6
    }
Packit Service a31ea6
    if ((in < inend) && (out < outend) && (*in < 0x80)) {
Packit Service a31ea6
        *out++ =  *in++;
Packit Service a31ea6
    }
Packit Service a31ea6
    if ((in < inend) && (out < outend) && (*in < 0x80)) {
Packit Service a31ea6
        *out++ =  *in++;
Packit Service a31ea6
    }
Packit Service a31ea6
    *outlen = out - outstart;
Packit Service a31ea6
    *inlen = in - instart;
Packit Service a31ea6
    return (*outlen);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
Packit Service a31ea6
/************************************************************************
Packit Service a31ea6
 * Lookup tables for ISO-8859-2..ISO-8859-16 transcoding                *
Packit Service a31ea6
 ************************************************************************/
Packit Service a31ea6
Packit Service a31ea6
static unsigned short const xmlunicodetable_ISO8859_2 [128] = {
Packit Service a31ea6
    0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
Packit Service a31ea6
    0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
Packit Service a31ea6
    0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
Packit Service a31ea6
    0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
Packit Service a31ea6
    0x00a0, 0x0104, 0x02d8, 0x0141, 0x00a4, 0x013d, 0x015a, 0x00a7,
Packit Service a31ea6
    0x00a8, 0x0160, 0x015e, 0x0164, 0x0179, 0x00ad, 0x017d, 0x017b,
Packit Service a31ea6
    0x00b0, 0x0105, 0x02db, 0x0142, 0x00b4, 0x013e, 0x015b, 0x02c7,
Packit Service a31ea6
    0x00b8, 0x0161, 0x015f, 0x0165, 0x017a, 0x02dd, 0x017e, 0x017c,
Packit Service a31ea6
    0x0154, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0139, 0x0106, 0x00c7,
Packit Service a31ea6
    0x010c, 0x00c9, 0x0118, 0x00cb, 0x011a, 0x00cd, 0x00ce, 0x010e,
Packit Service a31ea6
    0x0110, 0x0143, 0x0147, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x00d7,
Packit Service a31ea6
    0x0158, 0x016e, 0x00da, 0x0170, 0x00dc, 0x00dd, 0x0162, 0x00df,
Packit Service a31ea6
    0x0155, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x013a, 0x0107, 0x00e7,
Packit Service a31ea6
    0x010d, 0x00e9, 0x0119, 0x00eb, 0x011b, 0x00ed, 0x00ee, 0x010f,
Packit Service a31ea6
    0x0111, 0x0144, 0x0148, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x00f7,
Packit Service a31ea6
    0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9,
Packit Service a31ea6
};
Packit Service a31ea6
Packit Service a31ea6
static unsigned char const xmltranscodetable_ISO8859_2 [48 + 6 * 64] = {
Packit Service a31ea6
    "\x00\x00\x01\x05\x02\x04\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
Packit Service a31ea6
    "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
Packit Service a31ea6
    "\xa0\x00\x00\x00\xa4\x00\x00\xa7\xa8\x00\x00\x00\x00\xad\x00\x00"
Packit Service a31ea6
    "\xb0\x00\x00\x00\xb4\x00\x00\x00\xb8\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\xc3\xe3\xa1\xb1\xc6\xe6\x00\x00\x00\x00\xc8\xe8\xcf\xef"
Packit Service a31ea6
    "\xd0\xf0\x00\x00\x00\x00\x00\x00\xca\xea\xcc\xec\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc5\xe5\x00\x00\xa5\xb5\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\xb7\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\xa2\xff\x00\xb2\x00\xbd\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\xa3\xb3\xd1\xf1\x00\x00\xd2\xf2\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\xd5\xf5\x00\x00\xc0\xe0\x00\x00\xd8\xf8\xa6\xb6\x00\x00\xaa\xba"
Packit Service a31ea6
    "\xa9\xb9\xde\xfe\xab\xbb\x00\x00\x00\x00\x00\x00\x00\x00\xd9\xf9"
Packit Service a31ea6
    "\xdb\xfb\x00\x00\x00\x00\x00\x00\x00\xac\xbc\xaf\xbf\xae\xbe\x00"
Packit Service a31ea6
    "\x00\xc1\xc2\x00\xc4\x00\x00\xc7\x00\xc9\x00\xcb\x00\xcd\xce\x00"
Packit Service a31ea6
    "\x00\x00\x00\xd3\xd4\x00\xd6\xd7\x00\x00\xda\x00\xdc\xdd\x00\xdf"
Packit Service a31ea6
    "\x00\xe1\xe2\x00\xe4\x00\x00\xe7\x00\xe9\x00\xeb\x00\xed\xee\x00"
Packit Service a31ea6
    "\x00\x00\x00\xf3\xf4\x00\xf6\xf7\x00\x00\xfa\x00\xfc\xfd\x00\x00"
Packit Service a31ea6
};
Packit Service a31ea6
Packit Service a31ea6
static unsigned short const xmlunicodetable_ISO8859_3 [128] = {
Packit Service a31ea6
    0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
Packit Service a31ea6
    0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
Packit Service a31ea6
    0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
Packit Service a31ea6
    0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
Packit Service a31ea6
    0x00a0, 0x0126, 0x02d8, 0x00a3, 0x00a4, 0x0000, 0x0124, 0x00a7,
Packit Service a31ea6
    0x00a8, 0x0130, 0x015e, 0x011e, 0x0134, 0x00ad, 0x0000, 0x017b,
Packit Service a31ea6
    0x00b0, 0x0127, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x0125, 0x00b7,
Packit Service a31ea6
    0x00b8, 0x0131, 0x015f, 0x011f, 0x0135, 0x00bd, 0x0000, 0x017c,
Packit Service a31ea6
    0x00c0, 0x00c1, 0x00c2, 0x0000, 0x00c4, 0x010a, 0x0108, 0x00c7,
Packit Service a31ea6
    0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
Packit Service a31ea6
    0x0000, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x0120, 0x00d6, 0x00d7,
Packit Service a31ea6
    0x011c, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x016c, 0x015c, 0x00df,
Packit Service a31ea6
    0x00e0, 0x00e1, 0x00e2, 0x0000, 0x00e4, 0x010b, 0x0109, 0x00e7,
Packit Service a31ea6
    0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
Packit Service a31ea6
    0x0000, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x0121, 0x00f6, 0x00f7,
Packit Service a31ea6
    0x011d, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x016d, 0x015d, 0x02d9,
Packit Service a31ea6
};
Packit Service a31ea6
Packit Service a31ea6
static unsigned char const xmltranscodetable_ISO8859_3 [48 + 7 * 64] = {
Packit Service a31ea6
    "\x04\x00\x01\x06\x02\x05\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
Packit Service a31ea6
    "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
Packit Service a31ea6
    "\xa0\x00\x00\xa3\xa4\x00\x00\xa7\xa8\x00\x00\x00\x00\xad\x00\x00"
Packit Service a31ea6
    "\xb0\x00\xb2\xb3\xb4\xb5\x00\xb7\xb8\x00\x00\x00\x00\xbd\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\xc6\xe6\xc5\xe5\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd8\xf8\xab\xbb"
Packit Service a31ea6
    "\xd5\xf5\x00\x00\xa6\xb6\xa1\xb1\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\xa9\xb9\x00\x00\xac\xbc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\xa2\xff\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\xf0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xfe\xaa\xba"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xdd\xfd\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xaf\xbf\x00\x00\x00"
Packit Service a31ea6
    "\xc0\xc1\xc2\x00\xc4\x00\x00\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
Packit Service a31ea6
    "\x00\xd1\xd2\xd3\xd4\x00\xd6\xd7\x00\xd9\xda\xdb\xdc\x00\x00\xdf"
Packit Service a31ea6
    "\xe0\xe1\xe2\x00\xe4\x00\x00\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef"
Packit Service a31ea6
    "\x00\xf1\xf2\xf3\xf4\x00\xf6\xf7\x00\xf9\xfa\xfb\xfc\x00\x00\x00"
Packit Service a31ea6
};
Packit Service a31ea6
Packit Service a31ea6
static unsigned short const xmlunicodetable_ISO8859_4 [128] = {
Packit Service a31ea6
    0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
Packit Service a31ea6
    0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
Packit Service a31ea6
    0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
Packit Service a31ea6
    0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
Packit Service a31ea6
    0x00a0, 0x0104, 0x0138, 0x0156, 0x00a4, 0x0128, 0x013b, 0x00a7,
Packit Service a31ea6
    0x00a8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00ad, 0x017d, 0x00af,
Packit Service a31ea6
    0x00b0, 0x0105, 0x02db, 0x0157, 0x00b4, 0x0129, 0x013c, 0x02c7,
Packit Service a31ea6
    0x00b8, 0x0161, 0x0113, 0x0123, 0x0167, 0x014a, 0x017e, 0x014b,
Packit Service a31ea6
    0x0100, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x012e,
Packit Service a31ea6
    0x010c, 0x00c9, 0x0118, 0x00cb, 0x0116, 0x00cd, 0x00ce, 0x012a,
Packit Service a31ea6
    0x0110, 0x0145, 0x014c, 0x0136, 0x00d4, 0x00d5, 0x00d6, 0x00d7,
Packit Service a31ea6
    0x00d8, 0x0172, 0x00da, 0x00db, 0x00dc, 0x0168, 0x016a, 0x00df,
Packit Service a31ea6
    0x0101, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x012f,
Packit Service a31ea6
    0x010d, 0x00e9, 0x0119, 0x00eb, 0x0117, 0x00ed, 0x00ee, 0x012b,
Packit Service a31ea6
    0x0111, 0x0146, 0x014d, 0x0137, 0x00f4, 0x00f5, 0x00f6, 0x00f7,
Packit Service a31ea6
    0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x0169, 0x016b, 0x02d9,
Packit Service a31ea6
};
Packit Service a31ea6
Packit Service a31ea6
static unsigned char const xmltranscodetable_ISO8859_4 [48 + 6 * 64] = {
Packit Service a31ea6
    "\x00\x00\x01\x05\x02\x03\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
Packit Service a31ea6
    "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
Packit Service a31ea6
    "\xa0\x00\x00\x00\xa4\x00\x00\xa7\xa8\x00\x00\x00\x00\xad\x00\xaf"
Packit Service a31ea6
    "\xb0\x00\x00\x00\xb4\x00\x00\x00\xb8\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\xc0\xe0\x00\x00\xa1\xb1\x00\x00\x00\x00\x00\x00\xc8\xe8\x00\x00"
Packit Service a31ea6
    "\xd0\xf0\xaa\xba\x00\x00\xcc\xec\xca\xea\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\xab\xbb\x00\x00\x00\x00\xa5\xb5\xcf\xef\x00\x00\xc7\xe7"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\xd3\xf3\xa2\x00\x00\xa6\xb6\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\xd1\xf1\x00\x00\x00\xbd\xbf\xd2\xf2\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\xa3\xb3\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\xa9\xb9\x00\x00\x00\x00\xac\xbc\xdd\xfd\xde\xfe\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\xd9\xf9\x00\x00\x00\x00\x00\x00\x00\x00\x00\xae\xbe\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\xb7\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\x00\xb2\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\xc1\xc2\xc3\xc4\xc5\xc6\x00\x00\xc9\x00\xcb\x00\xcd\xce\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\xd4\xd5\xd6\xd7\xd8\x00\xda\xdb\xdc\x00\x00\xdf"
Packit Service a31ea6
    "\x00\xe1\xe2\xe3\xe4\xe5\xe6\x00\x00\xe9\x00\xeb\x00\xed\xee\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\xf4\xf5\xf6\xf7\xf8\x00\xfa\xfb\xfc\x00\x00\x00"
Packit Service a31ea6
};
Packit Service a31ea6
Packit Service a31ea6
static unsigned short const xmlunicodetable_ISO8859_5 [128] = {
Packit Service a31ea6
    0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
Packit Service a31ea6
    0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
Packit Service a31ea6
    0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
Packit Service a31ea6
    0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
Packit Service a31ea6
    0x00a0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407,
Packit Service a31ea6
    0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x00ad, 0x040e, 0x040f,
Packit Service a31ea6
    0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417,
Packit Service a31ea6
    0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f,
Packit Service a31ea6
    0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427,
Packit Service a31ea6
    0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f,
Packit Service a31ea6
    0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437,
Packit Service a31ea6
    0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f,
Packit Service a31ea6
    0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447,
Packit Service a31ea6
    0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f,
Packit Service a31ea6
    0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457,
Packit Service a31ea6
    0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x00a7, 0x045e, 0x045f,
Packit Service a31ea6
};
Packit Service a31ea6
Packit Service a31ea6
static unsigned char const xmltranscodetable_ISO8859_5 [48 + 6 * 64] = {
Packit Service a31ea6
    "\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x02\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
Packit Service a31ea6
    "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
Packit Service a31ea6
    "\xa0\x00\x00\x00\x00\x00\x00\xfd\x00\x00\x00\x00\x00\xad\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\x00\xae\xaf"
Packit Service a31ea6
    "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
Packit Service a31ea6
    "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
Packit Service a31ea6
    "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
Packit Service a31ea6
    "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef"
Packit Service a31ea6
    "\x00\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\x00\xfe\xff"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\xf0\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
};
Packit Service a31ea6
Packit Service a31ea6
static unsigned short const xmlunicodetable_ISO8859_6 [128] = {
Packit Service a31ea6
    0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
Packit Service a31ea6
    0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
Packit Service a31ea6
    0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
Packit Service a31ea6
    0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
Packit Service a31ea6
    0x00a0, 0x0000, 0x0000, 0x0000, 0x00a4, 0x0000, 0x0000, 0x0000,
Packit Service a31ea6
    0x0000, 0x0000, 0x0000, 0x0000, 0x060c, 0x00ad, 0x0000, 0x0000,
Packit Service a31ea6
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
Packit Service a31ea6
    0x0000, 0x0000, 0x0000, 0x061b, 0x0000, 0x0000, 0x0000, 0x061f,
Packit Service a31ea6
    0x0000, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627,
Packit Service a31ea6
    0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f,
Packit Service a31ea6
    0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637,
Packit Service a31ea6
    0x0638, 0x0639, 0x063a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
Packit Service a31ea6
    0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647,
Packit Service a31ea6
    0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f,
Packit Service a31ea6
    0x0650, 0x0651, 0x0652, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
Packit Service a31ea6
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
Packit Service a31ea6
};
Packit Service a31ea6
Packit Service a31ea6
static unsigned char const xmltranscodetable_ISO8859_6 [48 + 5 * 64] = {
Packit Service a31ea6
    "\x02\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x03\x04\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
Packit Service a31ea6
    "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
Packit Service a31ea6
    "\xa0\x00\x00\x00\xa4\x00\x00\x00\x00\x00\x00\x00\x00\xad\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xac\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xbb\x00\x00\x00\xbf"
Packit Service a31ea6
    "\x00\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
Packit Service a31ea6
    "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef"
Packit Service a31ea6
    "\xf0\xf1\xf2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
};
Packit Service a31ea6
Packit Service a31ea6
static unsigned short const xmlunicodetable_ISO8859_7 [128] = {
Packit Service a31ea6
    0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
Packit Service a31ea6
    0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
Packit Service a31ea6
    0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
Packit Service a31ea6
    0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
Packit Service a31ea6
    0x00a0, 0x2018, 0x2019, 0x00a3, 0x0000, 0x0000, 0x00a6, 0x00a7,
Packit Service a31ea6
    0x00a8, 0x00a9, 0x0000, 0x00ab, 0x00ac, 0x00ad, 0x0000, 0x2015,
Packit Service a31ea6
    0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x0384, 0x0385, 0x0386, 0x00b7,
Packit Service a31ea6
    0x0388, 0x0389, 0x038a, 0x00bb, 0x038c, 0x00bd, 0x038e, 0x038f,
Packit Service a31ea6
    0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397,
Packit Service a31ea6
    0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f,
Packit Service a31ea6
    0x03a0, 0x03a1, 0x0000, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7,
Packit Service a31ea6
    0x03a8, 0x03a9, 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03ae, 0x03af,
Packit Service a31ea6
    0x03b0, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7,
Packit Service a31ea6
    0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf,
Packit Service a31ea6
    0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7,
Packit Service a31ea6
    0x03c8, 0x03c9, 0x03ca, 0x03cb, 0x03cc, 0x03cd, 0x03ce, 0x0000,
Packit Service a31ea6
};
Packit Service a31ea6
Packit Service a31ea6
static unsigned char const xmltranscodetable_ISO8859_7 [48 + 7 * 64] = {
Packit Service a31ea6
    "\x04\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x06"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
Packit Service a31ea6
    "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
Packit Service a31ea6
    "\xa0\x00\x00\xa3\x00\x00\xa6\xa7\xa8\xa9\x00\xab\xac\xad\x00\x00"
Packit Service a31ea6
    "\xb0\xb1\xb2\xb3\x00\x00\x00\xb7\x00\x00\x00\xbb\x00\xbd\x00\x00"
Packit Service a31ea6
    "\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\xaf\x00\x00\xa1\xa2\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\xb4\xb5\xb6\x00\xb8\xb9\xba\x00\xbc\x00\xbe\xbf"
Packit Service a31ea6
    "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
Packit Service a31ea6
    "\xd0\xd1\x00\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
Packit Service a31ea6
    "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef"
Packit Service a31ea6
    "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
};
Packit Service a31ea6
Packit Service a31ea6
static unsigned short const xmlunicodetable_ISO8859_8 [128] = {
Packit Service a31ea6
    0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
Packit Service a31ea6
    0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
Packit Service a31ea6
    0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
Packit Service a31ea6
    0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
Packit Service a31ea6
    0x00a0, 0x0000, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7,
Packit Service a31ea6
    0x00a8, 0x00a9, 0x00d7, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
Packit Service a31ea6
    0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7,
Packit Service a31ea6
    0x00b8, 0x00b9, 0x00f7, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x0000,
Packit Service a31ea6
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
Packit Service a31ea6
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
Packit Service a31ea6
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
Packit Service a31ea6
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2017,
Packit Service a31ea6
    0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7,
Packit Service a31ea6
    0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df,
Packit Service a31ea6
    0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7,
Packit Service a31ea6
    0x05e8, 0x05e9, 0x05ea, 0x0000, 0x0000, 0x200e, 0x200f, 0x0000,
Packit Service a31ea6
};
Packit Service a31ea6
Packit Service a31ea6
static unsigned char const xmltranscodetable_ISO8859_8 [48 + 7 * 64] = {
Packit Service a31ea6
    "\x02\x00\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
Packit Service a31ea6
    "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
Packit Service a31ea6
    "\xa0\x00\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\x00\xab\xac\xad\xae\xaf"
Packit Service a31ea6
    "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\x00\xbb\xbc\xbd\xbe\x00"
Packit Service a31ea6
    "\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\xaa\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\xba\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfd\xfe"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\xdf\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef"
Packit Service a31ea6
    "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
};
Packit Service a31ea6
Packit Service a31ea6
static unsigned short const xmlunicodetable_ISO8859_9 [128] = {
Packit Service a31ea6
    0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
Packit Service a31ea6
    0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
Packit Service a31ea6
    0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
Packit Service a31ea6
    0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
Packit Service a31ea6
    0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7,
Packit Service a31ea6
    0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
Packit Service a31ea6
    0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7,
Packit Service a31ea6
    0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf,
Packit Service a31ea6
    0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7,
Packit Service a31ea6
    0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
Packit Service a31ea6
    0x011e, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7,
Packit Service a31ea6
    0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0130, 0x015e, 0x00df,
Packit Service a31ea6
    0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7,
Packit Service a31ea6
    0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
Packit Service a31ea6
    0x011f, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7,
Packit Service a31ea6
    0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0131, 0x015f, 0x00ff,
Packit Service a31ea6
};
Packit Service a31ea6
Packit Service a31ea6
static unsigned char const xmltranscodetable_ISO8859_9 [48 + 5 * 64] = {
Packit Service a31ea6
    "\x00\x00\x01\x02\x03\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
Packit Service a31ea6
    "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
Packit Service a31ea6
    "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
Packit Service a31ea6
    "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
Packit Service a31ea6
    "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
Packit Service a31ea6
    "\x00\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\x00\x00\xdf"
Packit Service a31ea6
    "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef"
Packit Service a31ea6
    "\x00\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\x00\x00\xff"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd0\xf0"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\xdd\xfd\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xfe"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
};
Packit Service a31ea6
Packit Service a31ea6
static unsigned short const xmlunicodetable_ISO8859_10 [128] = {
Packit Service a31ea6
    0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
Packit Service a31ea6
    0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
Packit Service a31ea6
    0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
Packit Service a31ea6
    0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
Packit Service a31ea6
    0x00a0, 0x0104, 0x0112, 0x0122, 0x012a, 0x0128, 0x0136, 0x00a7,
Packit Service a31ea6
    0x013b, 0x0110, 0x0160, 0x0166, 0x017d, 0x00ad, 0x016a, 0x014a,
Packit Service a31ea6
    0x00b0, 0x0105, 0x0113, 0x0123, 0x012b, 0x0129, 0x0137, 0x00b7,
Packit Service a31ea6
    0x013c, 0x0111, 0x0161, 0x0167, 0x017e, 0x2015, 0x016b, 0x014b,
Packit Service a31ea6
    0x0100, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x012e,
Packit Service a31ea6
    0x010c, 0x00c9, 0x0118, 0x00cb, 0x0116, 0x00cd, 0x00ce, 0x00cf,
Packit Service a31ea6
    0x00d0, 0x0145, 0x014c, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x0168,
Packit Service a31ea6
    0x00d8, 0x0172, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df,
Packit Service a31ea6
    0x0101, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x012f,
Packit Service a31ea6
    0x010d, 0x00e9, 0x0119, 0x00eb, 0x0117, 0x00ed, 0x00ee, 0x00ef,
Packit Service a31ea6
    0x00f0, 0x0146, 0x014d, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x0169,
Packit Service a31ea6
    0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x0138,
Packit Service a31ea6
};
Packit Service a31ea6
Packit Service a31ea6
static unsigned char const xmltranscodetable_ISO8859_10 [48 + 7 * 64] = {
Packit Service a31ea6
    "\x00\x00\x01\x06\x02\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
Packit Service a31ea6
    "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
Packit Service a31ea6
    "\xa0\x00\x00\x00\x00\x00\x00\xa7\x00\x00\x00\x00\x00\xad\x00\x00"
Packit Service a31ea6
    "\xb0\x00\x00\x00\x00\x00\x00\xb7\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\xc0\xe0\x00\x00\xa1\xb1\x00\x00\x00\x00\x00\x00\xc8\xe8\x00\x00"
Packit Service a31ea6
    "\xa9\xb9\xa2\xb2\x00\x00\xcc\xec\xca\xea\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\xa3\xb3\x00\x00\x00\x00\xa5\xb5\xa4\xb4\x00\x00\xc7\xe7"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\xa6\xb6\xff\x00\x00\xa8\xb8\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\xd1\xf1\x00\x00\x00\xaf\xbf\xd2\xf2\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\xaa\xba\x00\x00\x00\x00\xab\xbb\xd7\xf7\xae\xbe\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\xd9\xf9\x00\x00\x00\x00\x00\x00\x00\x00\x00\xac\xbc\x00"
Packit Service a31ea6
    "\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\xbd\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\xc1\xc2\xc3\xc4\xc5\xc6\x00\x00\xc9\x00\xcb\x00\xcd\xce\xcf"
Packit Service a31ea6
    "\xd0\x00\x00\xd3\xd4\xd5\xd6\x00\xd8\x00\xda\xdb\xdc\xdd\xde\xdf"
Packit Service a31ea6
    "\x00\xe1\xe2\xe3\xe4\xe5\xe6\x00\x00\xe9\x00\xeb\x00\xed\xee\xef"
Packit Service a31ea6
    "\xf0\x00\x00\xf3\xf4\xf5\xf6\x00\xf8\x00\xfa\xfb\xfc\xfd\xfe\x00"
Packit Service a31ea6
};
Packit Service a31ea6
Packit Service a31ea6
static unsigned short const xmlunicodetable_ISO8859_11 [128] = {
Packit Service a31ea6
    0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
Packit Service a31ea6
    0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
Packit Service a31ea6
    0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
Packit Service a31ea6
    0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
Packit Service a31ea6
    0x00a0, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07,
Packit Service a31ea6
    0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f,
Packit Service a31ea6
    0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17,
Packit Service a31ea6
    0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f,
Packit Service a31ea6
    0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27,
Packit Service a31ea6
    0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f,
Packit Service a31ea6
    0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37,
Packit Service a31ea6
    0x0e38, 0x0e39, 0x0e3a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0e3f,
Packit Service a31ea6
    0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47,
Packit Service a31ea6
    0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0e4e, 0x0e4f,
Packit Service a31ea6
    0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57,
Packit Service a31ea6
    0x0e58, 0x0e59, 0x0e5a, 0x0e5b, 0x0000, 0x0000, 0x0000, 0x0000,
Packit Service a31ea6
};
Packit Service a31ea6
Packit Service a31ea6
static unsigned char const xmltranscodetable_ISO8859_11 [48 + 6 * 64] = {
Packit Service a31ea6
    "\x04\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
Packit Service a31ea6
    "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
Packit Service a31ea6
    "\xa0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x03\x05\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
Packit Service a31ea6
    "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
Packit Service a31ea6
    "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
Packit Service a31ea6
    "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\x00\x00\x00\x00\xdf"
Packit Service a31ea6
    "\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef"
Packit Service a31ea6
    "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
};
Packit Service a31ea6
Packit Service a31ea6
static unsigned short const xmlunicodetable_ISO8859_13 [128] = {
Packit Service a31ea6
    0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
Packit Service a31ea6
    0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
Packit Service a31ea6
    0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
Packit Service a31ea6
    0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
Packit Service a31ea6
    0x00a0, 0x201d, 0x00a2, 0x00a3, 0x00a4, 0x201e, 0x00a6, 0x00a7,
Packit Service a31ea6
    0x00d8, 0x00a9, 0x0156, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00c6,
Packit Service a31ea6
    0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x201c, 0x00b5, 0x00b6, 0x00b7,
Packit Service a31ea6
    0x00f8, 0x00b9, 0x0157, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00e6,
Packit Service a31ea6
    0x0104, 0x012e, 0x0100, 0x0106, 0x00c4, 0x00c5, 0x0118, 0x0112,
Packit Service a31ea6
    0x010c, 0x00c9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012a, 0x013b,
Packit Service a31ea6
    0x0160, 0x0143, 0x0145, 0x00d3, 0x014c, 0x00d5, 0x00d6, 0x00d7,
Packit Service a31ea6
    0x0172, 0x0141, 0x015a, 0x016a, 0x00dc, 0x017b, 0x017d, 0x00df,
Packit Service a31ea6
    0x0105, 0x012f, 0x0101, 0x0107, 0x00e4, 0x00e5, 0x0119, 0x0113,
Packit Service a31ea6
    0x010d, 0x00e9, 0x017a, 0x0117, 0x0123, 0x0137, 0x012b, 0x013c,
Packit Service a31ea6
    0x0161, 0x0144, 0x0146, 0x00f3, 0x014d, 0x00f5, 0x00f6, 0x00f7,
Packit Service a31ea6
    0x0173, 0x0142, 0x015b, 0x016b, 0x00fc, 0x017c, 0x017e, 0x2019,
Packit Service a31ea6
};
Packit Service a31ea6
Packit Service a31ea6
static unsigned char const xmltranscodetable_ISO8859_13 [48 + 7 * 64] = {
Packit Service a31ea6
    "\x00\x00\x01\x04\x06\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
Packit Service a31ea6
    "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
Packit Service a31ea6
    "\xa0\x00\xa2\xa3\xa4\x00\xa6\xa7\x00\xa9\x00\xab\xac\xad\xae\x00"
Packit Service a31ea6
    "\xb0\xb1\xb2\xb3\x00\xb5\xb6\xb7\x00\xb9\x00\xbb\xbc\xbd\xbe\x00"
Packit Service a31ea6
    "\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\x00\x00\xb4\xa1\xa5\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\xc4\xc5\xaf\x00\x00\xc9\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\xd3\x00\xd5\xd6\xd7\xa8\x00\x00\x00\xdc\x00\x00\xdf"
Packit Service a31ea6
    "\x00\x00\x00\x00\xe4\xe5\xbf\x00\x00\xe9\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\xf3\x00\xf5\xf6\xf7\xb8\x00\x00\x00\xfc\x00\x00\x00"
Packit Service a31ea6
    "\x00\xd9\xf9\xd1\xf1\xd2\xf2\x00\x00\x00\x00\x00\xd4\xf4\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\xaa\xba\x00\x00\xda\xfa\x00\x00\x00\x00"
Packit Service a31ea6
    "\xd0\xf0\x00\x00\x00\x00\x00\x00\x00\x00\xdb\xfb\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\xd8\xf8\x00\x00\x00\x00\x00\xca\xea\xdd\xfd\xde\xfe\x00"
Packit Service a31ea6
    "\xc2\xe2\x00\x00\xc0\xe0\xc3\xe3\x00\x00\x00\x00\xc8\xe8\x00\x00"
Packit Service a31ea6
    "\x00\x00\xc7\xe7\x00\x00\xcb\xeb\xc6\xe6\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\xcc\xec\x00\x00\x00\x00\x00\x00\xce\xee\x00\x00\xc1\xe1"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\xcd\xed\x00\x00\x00\xcf\xef\x00\x00\x00"
Packit Service a31ea6
};
Packit Service a31ea6
Packit Service a31ea6
static unsigned short const xmlunicodetable_ISO8859_14 [128] = {
Packit Service a31ea6
    0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
Packit Service a31ea6
    0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
Packit Service a31ea6
    0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
Packit Service a31ea6
    0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
Packit Service a31ea6
    0x00a0, 0x1e02, 0x1e03, 0x00a3, 0x010a, 0x010b, 0x1e0a, 0x00a7,
Packit Service a31ea6
    0x1e80, 0x00a9, 0x1e82, 0x1e0b, 0x1ef2, 0x00ad, 0x00ae, 0x0178,
Packit Service a31ea6
    0x1e1e, 0x1e1f, 0x0120, 0x0121, 0x1e40, 0x1e41, 0x00b6, 0x1e56,
Packit Service a31ea6
    0x1e81, 0x1e57, 0x1e83, 0x1e60, 0x1ef3, 0x1e84, 0x1e85, 0x1e61,
Packit Service a31ea6
    0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7,
Packit Service a31ea6
    0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
Packit Service a31ea6
    0x0174, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x1e6a,
Packit Service a31ea6
    0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x0176, 0x00df,
Packit Service a31ea6
    0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7,
Packit Service a31ea6
    0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
Packit Service a31ea6
    0x0175, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x1e6b,
Packit Service a31ea6
    0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x0177, 0x00ff,
Packit Service a31ea6
};
Packit Service a31ea6
Packit Service a31ea6
static unsigned char const xmltranscodetable_ISO8859_14 [48 + 10 * 64] = {
Packit Service a31ea6
    "\x00\x00\x01\x09\x04\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
Packit Service a31ea6
    "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
Packit Service a31ea6
    "\xa0\x00\x00\xa3\x00\x00\x00\xa7\x00\xa9\x00\x00\x00\xad\xae\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\xb6\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x03\x08\x05\x06\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\xa1\xa2\x00\x00\x00\x00\x00\x00\xa6\xab\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb0\xb1"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\xa5\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\xb2\xb3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\xa8\xb8\xaa\xba\xbd\xbe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\xac\xbc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\xd0\xf0\xde\xfe\xaf\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\xb4\xb5\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\xb7\xb9\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\xbb\xbf\x00\x00\x00\x00\x00\x00\x00\x00\xd7\xf7\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
Packit Service a31ea6
    "\x00\xd1\xd2\xd3\xd4\xd5\xd6\x00\xd8\xd9\xda\xdb\xdc\xdd\x00\xdf"
Packit Service a31ea6
    "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef"
Packit Service a31ea6
    "\x00\xf1\xf2\xf3\xf4\xf5\xf6\x00\xf8\xf9\xfa\xfb\xfc\xfd\x00\xff"
Packit Service a31ea6
};
Packit Service a31ea6
Packit Service a31ea6
static unsigned short const xmlunicodetable_ISO8859_15 [128] = {
Packit Service a31ea6
    0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
Packit Service a31ea6
    0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
Packit Service a31ea6
    0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
Packit Service a31ea6
    0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
Packit Service a31ea6
    0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x20ac, 0x00a5, 0x0160, 0x00a7,
Packit Service a31ea6
    0x0161, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
Packit Service a31ea6
    0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x017d, 0x00b5, 0x00b6, 0x00b7,
Packit Service a31ea6
    0x017e, 0x00b9, 0x00ba, 0x00bb, 0x0152, 0x0153, 0x0178, 0x00bf,
Packit Service a31ea6
    0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7,
Packit Service a31ea6
    0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
Packit Service a31ea6
    0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7,
Packit Service a31ea6
    0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df,
Packit Service a31ea6
    0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7,
Packit Service a31ea6
    0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
Packit Service a31ea6
    0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7,
Packit Service a31ea6
    0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff,
Packit Service a31ea6
};
Packit Service a31ea6
Packit Service a31ea6
static unsigned char const xmltranscodetable_ISO8859_15 [48 + 6 * 64] = {
Packit Service a31ea6
    "\x00\x00\x01\x05\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
Packit Service a31ea6
    "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
Packit Service a31ea6
    "\xa0\xa1\xa2\xa3\x00\xa5\x00\xa7\x00\xa9\xaa\xab\xac\xad\xae\xaf"
Packit Service a31ea6
    "\xb0\xb1\xb2\xb3\x00\xb5\xb6\xb7\x00\xb9\xba\xbb\x00\x00\x00\xbf"
Packit Service a31ea6
    "\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\xbc\xbd\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\xa6\xa8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\xbe\x00\x00\x00\x00\xb4\xb8\x00"
Packit Service a31ea6
    "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
Packit Service a31ea6
    "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
Packit Service a31ea6
    "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef"
Packit Service a31ea6
    "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
Packit Service a31ea6
};
Packit Service a31ea6
Packit Service a31ea6
static unsigned short const xmlunicodetable_ISO8859_16 [128] = {
Packit Service a31ea6
    0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
Packit Service a31ea6
    0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
Packit Service a31ea6
    0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
Packit Service a31ea6
    0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
Packit Service a31ea6
    0x00a0, 0x0104, 0x0105, 0x0141, 0x20ac, 0x201e, 0x0160, 0x00a7,
Packit Service a31ea6
    0x0161, 0x00a9, 0x0218, 0x00ab, 0x0179, 0x00ad, 0x017a, 0x017b,
Packit Service a31ea6
    0x00b0, 0x00b1, 0x010c, 0x0142, 0x017d, 0x201d, 0x00b6, 0x00b7,
Packit Service a31ea6
    0x017e, 0x010d, 0x0219, 0x00bb, 0x0152, 0x0153, 0x0178, 0x017c,
Packit Service a31ea6
    0x00c0, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0106, 0x00c6, 0x00c7,
Packit Service a31ea6
    0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
Packit Service a31ea6
    0x0110, 0x0143, 0x00d2, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x015a,
Packit Service a31ea6
    0x0170, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0118, 0x021a, 0x00df,
Packit Service a31ea6
    0x00e0, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x0107, 0x00e6, 0x00e7,
Packit Service a31ea6
    0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
Packit Service a31ea6
    0x0111, 0x0144, 0x00f2, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x015b,
Packit Service a31ea6
    0x0171, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0119, 0x021b, 0x00ff,
Packit Service a31ea6
};
Packit Service a31ea6
Packit Service a31ea6
static unsigned char const xmltranscodetable_ISO8859_16 [48 + 9 * 64] = {
Packit Service a31ea6
    "\x00\x00\x01\x08\x02\x03\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
Packit Service a31ea6
    "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
Packit Service a31ea6
    "\xa0\x00\x00\x00\x00\x00\x00\xa7\x00\xa9\x00\xab\x00\xad\x00\x00"
Packit Service a31ea6
    "\xb0\xb1\x00\x00\x00\x00\xb6\xb7\x00\x00\x00\xbb\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\xc3\xe3\xa1\xa2\xc5\xe5\x00\x00\x00\x00\xb2\xb9\x00\x00"
Packit Service a31ea6
    "\xd0\xf0\x00\x00\x00\x00\x00\x00\xdd\xfd\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\xa3\xb3\xd1\xf1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\xd5\xf5\xbc\xbd\x00\x00\x00\x00\x00\x00\xd7\xf7\x00\x00\x00\x00"
Packit Service a31ea6
    "\xa6\xa8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\xd8\xf8\x00\x00\x00\x00\x00\x00\xbe\xac\xae\xaf\xbf\xb4\xb8\x00"
Packit Service a31ea6
    "\x06\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb5\xa5\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\xaa\xba\xde\xfe\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Packit Service a31ea6
    "\xc0\xc1\xc2\x00\xc4\x00\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
Packit Service a31ea6
    "\x00\x00\xd2\xd3\xd4\x00\xd6\x00\x00\xd9\xda\xdb\xdc\x00\x00\xdf"
Packit Service a31ea6
    "\xe0\xe1\xe2\x00\xe4\x00\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef"
Packit Service a31ea6
    "\x00\x00\xf2\xf3\xf4\x00\xf6\x00\x00\xf9\xfa\xfb\xfc\x00\x00\xff"
Packit Service a31ea6
};
Packit Service a31ea6
Packit Service a31ea6
Packit Service a31ea6
/*
Packit Service a31ea6
 * auto-generated functions for ISO-8859-2 .. ISO-8859-16
Packit Service a31ea6
 */
Packit Service a31ea6
Packit Service a31ea6
static int ISO8859_2ToUTF8 (unsigned char* out, int *outlen,
Packit Service a31ea6
    const unsigned char* in, int *inlen) {
Packit Service a31ea6
    return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_2);
Packit Service a31ea6
}
Packit Service a31ea6
static int UTF8ToISO8859_2 (unsigned char* out, int *outlen,
Packit Service a31ea6
    const unsigned char* in, int *inlen) {
Packit Service a31ea6
    return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_2);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
static int ISO8859_3ToUTF8 (unsigned char* out, int *outlen,
Packit Service a31ea6
    const unsigned char* in, int *inlen) {
Packit Service a31ea6
    return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_3);
Packit Service a31ea6
}
Packit Service a31ea6
static int UTF8ToISO8859_3 (unsigned char* out, int *outlen,
Packit Service a31ea6
    const unsigned char* in, int *inlen) {
Packit Service a31ea6
    return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_3);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
static int ISO8859_4ToUTF8 (unsigned char* out, int *outlen,
Packit Service a31ea6
    const unsigned char* in, int *inlen) {
Packit Service a31ea6
    return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_4);
Packit Service a31ea6
}
Packit Service a31ea6
static int UTF8ToISO8859_4 (unsigned char* out, int *outlen,
Packit Service a31ea6
    const unsigned char* in, int *inlen) {
Packit Service a31ea6
    return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_4);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
static int ISO8859_5ToUTF8 (unsigned char* out, int *outlen,
Packit Service a31ea6
    const unsigned char* in, int *inlen) {
Packit Service a31ea6
    return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_5);
Packit Service a31ea6
}
Packit Service a31ea6
static int UTF8ToISO8859_5 (unsigned char* out, int *outlen,
Packit Service a31ea6
    const unsigned char* in, int *inlen) {
Packit Service a31ea6
    return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_5);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
static int ISO8859_6ToUTF8 (unsigned char* out, int *outlen,
Packit Service a31ea6
    const unsigned char* in, int *inlen) {
Packit Service a31ea6
    return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_6);
Packit Service a31ea6
}
Packit Service a31ea6
static int UTF8ToISO8859_6 (unsigned char* out, int *outlen,
Packit Service a31ea6
    const unsigned char* in, int *inlen) {
Packit Service a31ea6
    return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_6);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
static int ISO8859_7ToUTF8 (unsigned char* out, int *outlen,
Packit Service a31ea6
    const unsigned char* in, int *inlen) {
Packit Service a31ea6
    return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_7);
Packit Service a31ea6
}
Packit Service a31ea6
static int UTF8ToISO8859_7 (unsigned char* out, int *outlen,
Packit Service a31ea6
    const unsigned char* in, int *inlen) {
Packit Service a31ea6
    return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_7);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
static int ISO8859_8ToUTF8 (unsigned char* out, int *outlen,
Packit Service a31ea6
    const unsigned char* in, int *inlen) {
Packit Service a31ea6
    return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_8);
Packit Service a31ea6
}
Packit Service a31ea6
static int UTF8ToISO8859_8 (unsigned char* out, int *outlen,
Packit Service a31ea6
    const unsigned char* in, int *inlen) {
Packit Service a31ea6
    return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_8);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
static int ISO8859_9ToUTF8 (unsigned char* out, int *outlen,
Packit Service a31ea6
    const unsigned char* in, int *inlen) {
Packit Service a31ea6
    return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_9);
Packit Service a31ea6
}
Packit Service a31ea6
static int UTF8ToISO8859_9 (unsigned char* out, int *outlen,
Packit Service a31ea6
    const unsigned char* in, int *inlen) {
Packit Service a31ea6
    return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_9);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
static int ISO8859_10ToUTF8 (unsigned char* out, int *outlen,
Packit Service a31ea6
    const unsigned char* in, int *inlen) {
Packit Service a31ea6
    return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_10);
Packit Service a31ea6
}
Packit Service a31ea6
static int UTF8ToISO8859_10 (unsigned char* out, int *outlen,
Packit Service a31ea6
    const unsigned char* in, int *inlen) {
Packit Service a31ea6
    return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_10);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
static int ISO8859_11ToUTF8 (unsigned char* out, int *outlen,
Packit Service a31ea6
    const unsigned char* in, int *inlen) {
Packit Service a31ea6
    return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_11);
Packit Service a31ea6
}
Packit Service a31ea6
static int UTF8ToISO8859_11 (unsigned char* out, int *outlen,
Packit Service a31ea6
    const unsigned char* in, int *inlen) {
Packit Service a31ea6
    return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_11);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
static int ISO8859_13ToUTF8 (unsigned char* out, int *outlen,
Packit Service a31ea6
    const unsigned char* in, int *inlen) {
Packit Service a31ea6
    return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_13);
Packit Service a31ea6
}
Packit Service a31ea6
static int UTF8ToISO8859_13 (unsigned char* out, int *outlen,
Packit Service a31ea6
    const unsigned char* in, int *inlen) {
Packit Service a31ea6
    return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_13);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
static int ISO8859_14ToUTF8 (unsigned char* out, int *outlen,
Packit Service a31ea6
    const unsigned char* in, int *inlen) {
Packit Service a31ea6
    return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_14);
Packit Service a31ea6
}
Packit Service a31ea6
static int UTF8ToISO8859_14 (unsigned char* out, int *outlen,
Packit Service a31ea6
    const unsigned char* in, int *inlen) {
Packit Service a31ea6
    return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_14);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
static int ISO8859_15ToUTF8 (unsigned char* out, int *outlen,
Packit Service a31ea6
    const unsigned char* in, int *inlen) {
Packit Service a31ea6
    return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_15);
Packit Service a31ea6
}
Packit Service a31ea6
static int UTF8ToISO8859_15 (unsigned char* out, int *outlen,
Packit Service a31ea6
    const unsigned char* in, int *inlen) {
Packit Service a31ea6
    return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_15);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
static int ISO8859_16ToUTF8 (unsigned char* out, int *outlen,
Packit Service a31ea6
    const unsigned char* in, int *inlen) {
Packit Service a31ea6
    return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_16);
Packit Service a31ea6
}
Packit Service a31ea6
static int UTF8ToISO8859_16 (unsigned char* out, int *outlen,
Packit Service a31ea6
    const unsigned char* in, int *inlen) {
Packit Service a31ea6
    return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_16);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
static void
Packit Service a31ea6
xmlRegisterCharEncodingHandlersISO8859x (void) {
Packit Service a31ea6
    xmlNewCharEncodingHandler ("ISO-8859-2", ISO8859_2ToUTF8, UTF8ToISO8859_2);
Packit Service a31ea6
    xmlNewCharEncodingHandler ("ISO-8859-3", ISO8859_3ToUTF8, UTF8ToISO8859_3);
Packit Service a31ea6
    xmlNewCharEncodingHandler ("ISO-8859-4", ISO8859_4ToUTF8, UTF8ToISO8859_4);
Packit Service a31ea6
    xmlNewCharEncodingHandler ("ISO-8859-5", ISO8859_5ToUTF8, UTF8ToISO8859_5);
Packit Service a31ea6
    xmlNewCharEncodingHandler ("ISO-8859-6", ISO8859_6ToUTF8, UTF8ToISO8859_6);
Packit Service a31ea6
    xmlNewCharEncodingHandler ("ISO-8859-7", ISO8859_7ToUTF8, UTF8ToISO8859_7);
Packit Service a31ea6
    xmlNewCharEncodingHandler ("ISO-8859-8", ISO8859_8ToUTF8, UTF8ToISO8859_8);
Packit Service a31ea6
    xmlNewCharEncodingHandler ("ISO-8859-9", ISO8859_9ToUTF8, UTF8ToISO8859_9);
Packit Service a31ea6
    xmlNewCharEncodingHandler ("ISO-8859-10", ISO8859_10ToUTF8, UTF8ToISO8859_10);
Packit Service a31ea6
    xmlNewCharEncodingHandler ("ISO-8859-11", ISO8859_11ToUTF8, UTF8ToISO8859_11);
Packit Service a31ea6
    xmlNewCharEncodingHandler ("ISO-8859-13", ISO8859_13ToUTF8, UTF8ToISO8859_13);
Packit Service a31ea6
    xmlNewCharEncodingHandler ("ISO-8859-14", ISO8859_14ToUTF8, UTF8ToISO8859_14);
Packit Service a31ea6
    xmlNewCharEncodingHandler ("ISO-8859-15", ISO8859_15ToUTF8, UTF8ToISO8859_15);
Packit Service a31ea6
    xmlNewCharEncodingHandler ("ISO-8859-16", ISO8859_16ToUTF8, UTF8ToISO8859_16);
Packit Service a31ea6
}
Packit Service a31ea6
Packit Service a31ea6
#endif
Packit Service a31ea6
#endif
Packit Service a31ea6
Packit Service a31ea6
#define bottom_encoding
Packit Service a31ea6
#include "elfgcchack.h"