From: Adam Dickmeiss Date: Fri, 27 Sep 2013 13:16:06 +0000 (+0200) Subject: Merge branch 'master' into sru_2_0 X-Git-Tag: v5.0.0~16 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=04a6feeefe28e7f2f9f4701560b3344545a681c6;hp=2d59f978bb2171ecdd77d822a71379a7ca5f29c3 Merge branch 'master' into sru_2_0 --- diff --git a/include/yaz/yaz-iconv.h b/include/yaz/yaz-iconv.h index 4c763f7..4ce4e83 100644 --- a/include/yaz/yaz-iconv.h +++ b/include/yaz/yaz-iconv.h @@ -65,7 +65,7 @@ YAZ_EXPORT int yaz_iconv_close (yaz_iconv_t cd); /** \brief tests whether conversion is handled by YAZ' iconv or system iconv */ YAZ_EXPORT int yaz_iconv_isbuiltin(yaz_iconv_t cd); -YAZ_EXPORT unsigned long yaz_read_UTF8_char(unsigned char *inp, +YAZ_EXPORT unsigned long yaz_read_UTF8_char(const unsigned char *inp, size_t inbytesleft, size_t *no_read, int *error); diff --git a/src/marcdisp.c b/src/marcdisp.c index 12ecb38..ad9eed6 100644 --- a/src/marcdisp.c +++ b/src/marcdisp.c @@ -464,6 +464,15 @@ static size_t cdata_one_character(yaz_marc_t mt, const char *buf) } return 1; /* giving up */ } + else + { + int error = 0; + size_t no_read = 0; + (void) yaz_read_UTF8_char((const unsigned char *) buf, strlen(buf), + &no_read, &error); + if (error == 0 && no_read > 0) + return no_read; + } return 1; /* we don't know */ } diff --git a/src/utf8.c b/src/utf8.c index fcff6cd..1d2552b 100644 --- a/src/utf8.c +++ b/src/utf8.c @@ -38,7 +38,7 @@ static size_t init_utf8(yaz_iconv_t cd, yaz_iconv_decoder_t d, return 0; } -unsigned long yaz_read_UTF8_char(unsigned char *inp, +unsigned long yaz_read_UTF8_char(const unsigned char *inp, size_t inbytesleft, size_t *no_read, int *error) {