X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fstriconveha.h;h=9c4c676f3fb2452d62808c1021789d17176f4bc0;hb=a3a70ebafd7f2fdc069d43e8a26fc246dd7fe5bb;hp=28fc7e6b13a74d404220fb625796d8ffb797d551;hpb=36a6f6825953d52a32710a6c38d3ef3a5870d3ac;p=gnulib.git diff --git a/lib/striconveha.h b/lib/striconveha.h index 28fc7e6b1..9c4c676f3 100644 --- a/lib/striconveha.h +++ b/lib/striconveha.h @@ -19,6 +19,8 @@ #ifndef _STRICONVEHA_H #define _STRICONVEHA_H +#include + #include "striconveh.h" @@ -30,6 +32,13 @@ extern "C" { /* Convert an entire string from one encoding to another, using iconv. The original string is at [SRC,...,SRC+SRCLEN-1]. The "from" encoding can also be a name defined for autodetection. + If TRANSLITERATE is true, transliteration will attempted to avoid conversion + errors, for iconv implementations that support this. Usually you'll choose + TRANSLITERATE = true if HANDLER != iconveh_error. + If OFFSETS is not NULL, it should point to an array of SRCLEN integers; this + array is filled with offsets into the result, i.e. the character starting + at SRC[i] corresponds to the character starting at (*RESULTP)[OFFSETS[i]], + and other offsets are set to (size_t)(-1). *RESULTP and *LENGTH should initially be a scratch buffer and its size, or *RESULTP can initially be NULL. May erase the contents of the memory at *RESULTP. @@ -40,7 +49,9 @@ extern "C" { extern int mem_iconveha (const char *src, size_t srclen, const char *from_codeset, const char *to_codeset, + bool transliterate, enum iconv_ilseq_handler handler, + size_t *offsets, char **resultp, size_t *lengthp); /* Convert an entire string from one encoding to another, using iconv. @@ -48,12 +59,16 @@ extern int Both the "from" and the "to" encoding must use a single NUL byte at the end of the string (i.e. not UCS-2, UCS-4, UTF-16, UTF-32). The "from" encoding can also be a name defined for autodetection. + If TRANSLITERATE is true, transliteration will attempted to avoid conversion + errors, for iconv implementations that support this. Usually you'll choose + TRANSLITERATE = true if HANDLER != iconveh_error. Allocate a malloced memory block for the result. Return value: the freshly allocated resulting NUL-terminated string if successful, otherwise NULL and errno set. */ extern char * str_iconveha (const char *src, const char *from_codeset, const char *to_codeset, + bool transliterate, enum iconv_ilseq_handler handler);