From: Adam Dickmeiss Date: Tue, 10 Mar 2009 08:00:20 +0000 (+0100) Subject: Honor charset for raw records (ZOOM_record_get). X-Git-Tag: v3.0.45~16 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=588dde23995415ad84f97e50194ef943fadce6a9;p=yaz-moved-to-github.git Honor charset for raw records (ZOOM_record_get). For MARC and string records (octet aligned and SUTRS) the charset option now takes effect (if given). --- diff --git a/src/zoom-c.c b/src/zoom-c.c index c626c32..ebedbde 100644 --- a/src/zoom-c.c +++ b/src/zoom-c.c @@ -2157,11 +2157,10 @@ ZOOM_API(const char *) charset); else if (r->which == Z_External_octet) { - int marc_decode_type = YAZ_MARC_MARCXML; if (yaz_oid_is_iso2709(oid)) { const char *ret_buf = marc_iconv_return( - rec, marc_decode_type, len, + rec, YAZ_MARC_MARCXML, len, (const char *) r->u.octet_aligned->buf, r->u.octet_aligned->len, charset); @@ -2183,16 +2182,30 @@ ZOOM_API(const char *) else if (!strcmp(type, "raw")) { Z_External *r = (Z_External *) npr->u.databaseRecord; + const Odr_oid *oid = r->direct_reference; if (r->which == Z_External_sutrs) { - if (len) *len = r->u.sutrs->len; - return (const char *) r->u.sutrs->buf; + return record_iconv_return(rec, len, + (const char *) r->u.sutrs->buf, + r->u.sutrs->len, + charset); } else if (r->which == Z_External_octet) { - if (len) *len = r->u.octet_aligned->len; - return (const char *) r->u.octet_aligned->buf; + if (yaz_oid_is_iso2709(oid) && *charset) + { + const char *ret_buf = marc_iconv_return( + rec, YAZ_MARC_ISO2709, len, + (const char *) r->u.octet_aligned->buf, + r->u.octet_aligned->len, + charset); + return ret_buf; + } + return record_iconv_return(rec, len, + (const char *) r->u.octet_aligned->buf, + r->u.octet_aligned->len, + charset); } else /* grs-1, explain, OPAC, ... */ {