X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=util%2Fmarcdump.c;fp=util%2Fmarcdump.c;h=c45d146366d73ef06e489d2e76ab33d7c5bae508;hp=850331b48e8a4b7ca3670229f75903ef716e882e;hb=8ceaeefe2e491935cba91f56007308be6e4996e6;hpb=1b7419b08b3ac1d58bc8a147a5a563174276e151 diff --git a/util/marcdump.c b/util/marcdump.c index 850331b..c45d146 100644 --- a/util/marcdump.c +++ b/util/marcdump.c @@ -319,6 +319,7 @@ static void dump(const char *fname, const char *from, const char *to, size_t len_result; size_t r; char buf[100001]; + yaz_iconv_t cd1 = 0; r = fread(buf, 1, 5, inf); if (r < 5) @@ -428,7 +429,21 @@ static void dump(const char *fname, const char *from, const char *to, } } len_result = rlen; + + if (yaz_marc_check_marc21_coding(from, buf, 26)) + { + cd1 = yaz_iconv_open(to, "utf-8"); + if (cd1) + yaz_marc_iconv(mt, cd); + } r = yaz_marc_decode_buf(mt, buf, -1, &result, &len_result); + + if (cd1) + { + yaz_iconv_close(cd1); + yaz_marc_iconv(mt, cd); + } + if (r == -1) no_errors++; if (r > 0 && result && len_result)