1 /* This file is part of the YAZ toolkit.
2 * Copyright (C) 1995-2008 Index Data
3 * See the file LICENSE for details.
7 * \brief WCHAR_T iconv encoding / decoding
22 #include <yaz/xmalloc.h>
24 #include <yaz/snprintf.h>
29 unsigned long compose_char;
33 static size_t write_wchar_t(yaz_iconv_t cd, yaz_iconv_encoder_t en,
35 char **outbuf, size_t *outbytesleft)
37 unsigned char *outp = (unsigned char *) *outbuf;
39 if (*outbytesleft >= sizeof(wchar_t))
42 memcpy(outp, &wch, sizeof(wch));
44 (*outbytesleft) -= sizeof(wch);
48 yaz_iconv_set_errno(cd, YAZ_ICONV_E2BIG);
51 *outbuf = (char *) outp;
56 yaz_iconv_encoder_t yaz_wchar_encoder(const char *tocode,
57 yaz_iconv_encoder_t e)
61 if (!yaz_matchstr(tocode, "wchar_t"))
63 e->write_handle = write_wchar_t;
74 * indent-tabs-mode: nil
76 * vim: shiftwidth=4 tabstop=8 expandtab