2 * Copyright (C) 1995-2008, Index Data ApS
3 * See the file LICENSE for details.
8 * \brief WCHAR_T iconv encoding / decoding
23 #include <yaz/xmalloc.h>
25 #include <yaz/snprintf.h>
30 unsigned long compose_char;
34 static size_t write_wchar_t(yaz_iconv_t cd, yaz_iconv_encoder_t en,
36 char **outbuf, size_t *outbytesleft)
38 unsigned char *outp = (unsigned char *) *outbuf;
40 if (*outbytesleft >= sizeof(wchar_t))
43 memcpy(outp, &wch, sizeof(wch));
45 (*outbytesleft) -= sizeof(wch);
49 yaz_iconv_set_errno(cd, YAZ_ICONV_E2BIG);
52 *outbuf = (char *) outp;
57 yaz_iconv_encoder_t yaz_wchar_encoder(const char *tocode,
58 yaz_iconv_encoder_t e)
62 if (!yaz_matchstr(tocode, "wchar_t"))
64 e->write_handle = write_wchar_t;
75 * indent-tabs-mode: nil
77 * vim: shiftwidth=4 tabstop=8 expandtab