From: Adam Dickmeiss Date: Tue, 10 Dec 2013 11:54:30 +0000 (+0100) Subject: Fix encoding of 0x00a4 (unicode to danmarc) YAZ-713 X-Git-Tag: v5.0.6~6 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=6ee0d7c0404834a0a59547c3bd7e2686f838ce37;p=yaz-moved-to-github.git Fix encoding of 0x00a4 (unicode to danmarc) YAZ-713 --- diff --git a/src/iconv_encode_danmarc.c b/src/iconv_encode_danmarc.c index 467008a..08700a4 100644 --- a/src/iconv_encode_danmarc.c +++ b/src/iconv_encode_danmarc.c @@ -25,7 +25,7 @@ static size_t write_danmarc(yaz_iconv_t cd, yaz_iconv_encoder_t en, { unsigned char *outp = (unsigned char *) *outbuf; - if (x == '@' || x == '*' || x == 0xa4) + if (x == '@' || x == '*') { if (*outbytesleft < 2) { diff --git a/test/test_iconv.c b/test/test_iconv.c index ab05cee..76d3965 100644 --- a/test/test_iconv.c +++ b/test/test_iconv.c @@ -697,6 +697,7 @@ static void tst_danmarc_to_utf8(void) YAZ_CHECK(tst_convert(cd, "@*", "*")); YAZ_CHECK(tst_convert(cd, "@@", "@")); YAZ_CHECK(tst_convert(cd, "@\xa4", "\xC2\xA4")); + YAZ_CHECK(tst_convert(cd, "\xa4", "\xC2\xA4")); YAZ_CHECK(tst_convert(cd, "@\xe5", "\xEA\x9C\xB3")); YAZ_CHECK(tst_convert(cd, "@\xc5.", "\xEA\x9C\xB2" ".")); @@ -723,7 +724,7 @@ static void tst_utf8_to_danmarc(void) YAZ_CHECK(tst_convert(cd, "*", "@*")); YAZ_CHECK(tst_convert(cd, "@", "@@")); - YAZ_CHECK(tst_convert(cd, "\xC2\xA4", "@\xa4")); + YAZ_CHECK(tst_convert(cd, "\xC2\xA4", "\xa4")); YAZ_CHECK(tst_convert(cd, "a\xc3\xa5" "b", "a\xe5" "b")); /* aring */ YAZ_CHECK(tst_convert(cd, "a\xce\xbb" "b", "a@03BBb")); /* lambda */