X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=util%2Fcharmap.c;h=2ca7af1addf563fee0508888e1d0e3706b72aec5;hb=4097bac1dce126e79ce1550fad8b2034a311ff80;hp=85c9239cef9ed42414cb664b50e0a1eeb6851bf1;hpb=293023bab35c9ea0ced910e19b4d367d48a2cd69;p=idzebra-moved-to-github.git diff --git a/util/charmap.c b/util/charmap.c index 85c9239..2ca7af1 100644 --- a/util/charmap.c +++ b/util/charmap.c @@ -1,4 +1,4 @@ -/* $Id: charmap.c,v 1.45 2007-05-25 13:46:01 adam Exp $ +/* $Id: charmap.c,v 1.46 2007-05-25 14:05:52 adam Exp $ Copyright (C) 1995-2007 Index Data ApS @@ -420,6 +420,10 @@ static int scan_to_utf8(yaz_iconv_t t, ucs4_t *from, size_t inlen, else { ret = yaz_iconv(t, &inbuf, &inbytesleft, &outbuf, &outbytesleft); + if (ret != (size_t) (-1)) + ret = yaz_iconv(t, 0, 0, &outbuf, &outbytesleft); + + if (ret == (size_t) (-1)) { yaz_log(YLOG_LOG, "from: %2X %2X %2X %2X", @@ -454,6 +458,9 @@ static int scan_string(char *s_native, size_t ret; ret = yaz_iconv(t_unicode, &inbuf, &inbytesleft, &outbuf, &outbytesleft); + if (ret != (size_t)(-1)) + ret = yaz_iconv(t_unicode, 0, 0, &outbuf, &outbytesleft); + if (ret == (size_t)(-1)) return -1; i = (outbuf - (char*) arg)/sizeof(ucs4_t);