Fix encoding of 0x00a4 (unicode to danmarc) YAZ-713
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 10 Dec 2013 11:54:30 +0000 (12:54 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 10 Dec 2013 11:54:30 +0000 (12:54 +0100)
src/iconv_encode_danmarc.c
test/test_iconv.c

index 467008a..08700a4 100644 (file)
@@ -25,7 +25,7 @@ static size_t write_danmarc(yaz_iconv_t cd, yaz_iconv_encoder_t en,
 {
     unsigned char *outp = (unsigned char *) *outbuf;
 
 {
     unsigned char *outp = (unsigned char *) *outbuf;
 
-    if (x == '@' || x == '*' || x == 0xa4)
+    if (x == '@' || x == '*')
     {
         if (*outbytesleft < 2)
         {
     {
         if (*outbytesleft < 2)
         {
index ab05cee..76d3965 100644 (file)
@@ -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, "@*",  "*"));
     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" "."));
 
     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, "*",  "@*"));
     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 */
 
     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 */