removed old libs
[TestXSLT.git] / libiconv / extras / iconv_string.h
1 /* Copyright (C) 1999-2001 Bruno Haible.
2    This file is not part of the GNU LIBICONV Library.
3    This file is put into the public domain.  */
4
5 /*
6  * This C function converts an entire string from one encoding to another,
7  * using iconv. Easier to use than iconv() itself, and supports autodetect
8  * encodings on input.
9  *
10  *   int iconv_string (const char* tocode, const char* fromcode,
11  *                     const char* start, const char* end,
12  *                     char** resultp, size_t* lengthp)
13  *
14  * Converts a memory region given in encoding FROMCODE to a new memory
15  * region in encoding TOCODE. FROMCODE and TOCODE are as for iconv_open(3),
16  * except that FROMCODE may be one of the values
17  *    "autodetect_utf8"          supports ISO-8859-1 and UTF-8
18  *    "autodetect_jp"            supports EUC-JP, ISO-2022-JP-2 and SHIFT_JIS
19  *    "autodetect_kr"            supports EUC-KR and ISO-2022-KR
20  * The input is in the memory region between start (inclusive) and end
21  * (exclusive). If resultp is not NULL, the output string is stored in
22  * *resultp; malloc/realloc is used to allocate the result.
23  *
24  * This function does not treat zero characters specially.
25  *
26  * Return value: 0 if successful, otherwise -1 and errno set. Particular
27  * errno values: EILSEQ and ENOMEM.
28  *
29  * Example:
30  *   const char* s = ...;
31  *   char* result = NULL;
32  *   if (iconv_string("UCS-4-INTERNAL", "autodetect_utf8",
33  *                    s, s+strlen(s)+1, &result, NULL) < 0)
34  *     perror("iconv_string");
35  *
36  */
37 #include <stddef.h>
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43 extern int iconv_string (const char* tocode, const char* fromcode, const char* start, const char* end, char** resultp, size_t* lengthp);
44
45 #ifdef __cplusplus
46 }
47 #endif