MARC 8 encoding: never pass through ESC
[yaz-moved-to-github.git] / src / iconv_encode_marc8.c
index e8434ff..e05874f 100644 (file)
@@ -72,6 +72,11 @@ static unsigned long lookup_marc8(yaz_iconv_t cd,
     size_t utf8_outbytesleft = sizeof(utf8_buf)-1, r;
     int error_code;
 
+    if (x <= ' ' && x != 27)
+    {
+        *page_chr = ESC "(B";
+        return x;
+    }
     r = yaz_write_UTF8_char(x, &utf8_outbuf, &utf8_outbytesleft, &error_code);
     if (r == (size_t)(-1))
     {