* Copyright (C) 1995-2006, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: siconv.c,v 1.22 2006-04-24 23:21:26 adam Exp $
+ * $Id: siconv.c,v 1.23 2006-05-09 21:37:02 adam Exp $
*/
/**
* \file siconv.c
return 0;
}
-static size_t yaz_write_marc8(yaz_iconv_t cd, unsigned long x,
- char **outbuf, size_t *outbytesleft,
- int last)
+static size_t yaz_write_marc8_2(yaz_iconv_t cd, unsigned long x,
+ char **outbuf, size_t *outbytesleft,
+ int last)
{
int comb = 0;
const char *page_chr = 0;
return 0;
}
+static size_t yaz_write_marc8(yaz_iconv_t cd, unsigned long x,
+ char **outbuf, size_t *outbytesleft,
+ int last)
+{
+ int i;
+ for (i = 0; latin1_comb[i].x1; i++)
+ {
+ if (x == latin1_comb[i].y)
+ {
+ size_t r ;
+ /* save the output pointers .. */
+ char *outbuf0 = *outbuf;
+ size_t outbytesleft0 = *outbytesleft;
+ int last_ch = cd->write_marc8_last;
+
+ r = yaz_write_marc8_2(cd, latin1_comb[i].x1,
+ outbuf, outbytesleft, 0);
+ if (r)
+ return r;
+ r = yaz_write_marc8_2(cd, latin1_comb[i].x2,
+ outbuf, outbytesleft, last);
+ if (r && cd->my_errno == YAZ_ICONV_E2BIG)
+ {
+ /* not enough room. reset output to original values */
+ *outbuf = outbuf0;
+ *outbytesleft = outbytesleft0;
+ cd->write_marc8_last = last_ch;
+ }
+ return r;
+ }
+ }
+ return yaz_write_marc8_2(cd, x, outbuf, outbytesleft, last);
+}
+
+
#if HAVE_WCHAR_H
static size_t yaz_write_wchar_t (yaz_iconv_t cd, unsigned long x,
char **outbuf, size_t *outbytesleft,
* Copyright (C) 1995-2006, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: tsticonv.c,v 1.19 2006-05-03 13:01:04 adam Exp $
+ * $Id: tsticonv.c,v 1.20 2006-05-09 21:37:03 adam Exp $
*/
#if HAVE_CONFIG_H
/** D8: UPPERCASE SCANDINAVIAN O */
YAZ_CHECK(tst_convert(cd, "S\xd8", "S\xa2"));
-#if 0
- /* does not pass yet */
/** E9: LATIN SMALL LETTER E WITH ACUTE */
- YAZ_CHECK(tst_convert(cd,
- "Cours de math\xe9",
- "Cours de mathâe"));
-#endif
+ YAZ_CHECK(tst_convert(cd, "Cours de math\xe9", "Cours de mathâe"));
+ YAZ_CHECK(tst_convert(cd, "Cours de math", "Cours de math"
+ ));
+ YAZ_CHECK(tst_convert(cd, "Cours de mathé", "Cours de mathâe" ));
+ YAZ_CHECK(tst_convert(cd, "12345678é","12345678âe"));
+ YAZ_CHECK(tst_convert(cd, "123456789é", "123456789âe"));
+ YAZ_CHECK(tst_convert(cd, "1234567890é","1234567890âe"));
+ YAZ_CHECK(tst_convert(cd, "12345678901é", "12345678901âe"));
+ YAZ_CHECK(tst_convert(cd, "Cours de mathém", "Cours de mathâem"));
+ YAZ_CHECK(tst_convert(cd, "Cours de mathématiques",
+ "Cours de mathâematiques"));
yaz_iconv_close(cd);
}