X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=util%2Fcharmap.c;h=382dc088b911e11d704153e5ad047abc99414fcd;hb=0ef68e6e54cfd7a91a28ee3b1f305924ac34e787;hp=85c9239cef9ed42414cb664b50e0a1eeb6851bf1;hpb=293023bab35c9ea0ced910e19b4d367d48a2cd69;p=idzebra-moved-to-github.git diff --git a/util/charmap.c b/util/charmap.c index 85c9239..382dc08 100644 --- a/util/charmap.c +++ b/util/charmap.c @@ -1,8 +1,5 @@ -/* $Id: charmap.c,v 1.45 2007-05-25 13:46:01 adam Exp $ - Copyright (C) 1995-2007 - Index Data ApS - -This file is part of the Zebra server. +/* This file is part of the Zebra server. + Copyright (C) 1995-2008 Index Data Zebra is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -420,6 +417,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 +455,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);