- if (!strcmp(fromcode, "UTF-8"))
- cd->read_handle = yaz_read_UTF8;
- else if (!strcmp(fromcode, "ISO-8859-1"))
- cd->read_handle = yaz_read_ISO8859_1;
- else if (!strcmp(fromcode, "UCS-4"))
- cd->read_handle = yaz_read_UCS4;
-
-
- if (!strcmp(tocode, "UTF-8"))
- cd->write_handle = yaz_write_UTF8;
- else if (!strcmp (tocode, "ISO-8859-1"))
- cd->write_handle = yaz_write_ISO8859_1;
- else if (!strcmp (tocode, "UCS-4"))
- cd->write_handle = yaz_write_UCS4;
-
+ /* a useful hack: if fromcode has leading @,
+ the library not use YAZ's own conversions .. */
+ if (fromcode[0] == '@')
+ fromcode++;
+ else
+ {
+ if (!yaz_matchstr(fromcode, "UTF8"))
+ {
+ cd->read_handle = yaz_read_UTF8;
+ cd->init_handle = yaz_init_UTF8;
+ }
+ else if (!yaz_matchstr(fromcode, "ISO88591"))
+ cd->read_handle = yaz_read_ISO8859_1;
+ else if (!yaz_matchstr(fromcode, "UCS4"))
+ cd->read_handle = yaz_read_UCS4;
+ else if (!yaz_matchstr(fromcode, "UCS4LE"))
+ cd->read_handle = yaz_read_UCS4LE;
+ else if (!yaz_matchstr(fromcode, "MARC8"))
+ cd->read_handle = yaz_read_marc8;
+#if HAVE_WCHAR_H
+ else if (!yaz_matchstr(fromcode, "WCHAR_T"))
+ cd->read_handle = yaz_read_wchar_t;
+#endif
+
+ if (!yaz_matchstr(tocode, "UTF8"))
+ cd->write_handle = yaz_write_UTF8;
+ else if (!yaz_matchstr(tocode, "ISO88591"))
+ cd->write_handle = yaz_write_ISO8859_1;
+ else if (!yaz_matchstr (tocode, "UCS4"))
+ cd->write_handle = yaz_write_UCS4;
+ else if (!yaz_matchstr(tocode, "UCS4LE"))
+ cd->write_handle = yaz_write_UCS4LE;
+#if HAVE_WCHAR_H
+ else if (!yaz_matchstr(tocode, "WCHAR_T"))
+ cd->write_handle = yaz_write_wchar_t;
+#endif
+ }