2 Copyright (C) 2001-2004, 2006 Free Software Foundation, Inc.
3 Written by Bruno Haible and Simon Josefsson.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation,
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
35 /* Convert an entire string from one encoding to another, using iconv.
36 The original string is at [SRC,...,SRC+SRCLEN-1].
37 The conversion descriptor is passed as CD.
38 *RESULTP should initially contain NULL or a malloced memory block.
39 May change the size of the allocated memory block in *RESULTP, storing
40 its new address in *RESULTP and its new length in *LENGTHP.
41 Return value: 0 if successful, otherwise -1 and errno set.
42 If successful, the resulting string is stored in *RESULTP and its length
44 extern int mem_cd_iconv (const char *src, size_t srclen, iconv_t cd,
45 char **resultp, size_t *lengthp);
47 /* Convert an entire string from one encoding to another, using iconv.
48 The original string is the NUL-terminated string starting at SRC.
49 The conversion descriptor is passed as CD. Both the "from" and the "to"
50 encoding must use a single NUL byte at the end of the string (i.e. not
51 UCS-2, UCS-4, UTF-16, UTF-32).
52 Allocate a malloced memory block for the result.
53 Return value: the freshly allocated resulting NUL-terminated string if
54 successful, otherwise NULL and errno set. */
55 extern char * str_cd_iconv (const char *src, iconv_t cd);
59 /* Convert an entire string from one encoding to another, using iconv.
60 The original string is the NUL-terminated string starting at SRC.
61 Both the "from" and the "to" encoding must use a single NUL byte at the
62 end of the string (i.e. not UCS-2, UCS-4, UTF-16, UTF-32).
63 Allocate a malloced memory block for the result.
64 Return value: the freshly allocated resulting NUL-terminated string if
65 successful, otherwise NULL and errno set. */
66 extern char * str_iconv (const char *src,
67 const char *from_codeset, const char *to_codeset);
75 #endif /* _STRICONV_H */