From: Adam Dickmeiss Date: Tue, 8 Mar 2011 12:28:10 +0000 (+0100) Subject: Implement yaz_opac_decode_wrbuf2 X-Git-Tag: v4.1.5~3 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=45bf7a223153a11dcc07b1f1cb988f02af3a23f1 Implement yaz_opac_decode_wrbuf2 This function behaves likes yaz_opac_decode_wrbuf but takes yaz_iconv_t to allow character set conversion different from yaz_iconv_t part of yaz_marc_t. This is because OPAC record ASN.1 fields may have different encoding from the bibliographic MARC record. --- diff --git a/include/yaz/marcdisp.h b/include/yaz/marcdisp.h index 6c64854..c650fca 100644 --- a/include/yaz/marcdisp.h +++ b/include/yaz/marcdisp.h @@ -419,10 +419,25 @@ void yaz_marc_write_using_libxml2(yaz_marc_t mt, int enable); \param mt handle \param r OPAC record \param wrbuf WRBUF for resulting display string + + This function uses iconv_handle of yaz_marc_t for character set + conversion of both OPAC + ISO2709 part. \*/ YAZ_EXPORT void yaz_opac_decode_wrbuf(yaz_marc_t mt, Z_OPACRecord *r, WRBUF wrbuf); +/** \brief Performs "pretty" display of OPAC record to WRBUF using marc_t + \param mt handle + \param r OPAC record + \param wrbuf WRBUF for resulting display string + \param cd iconv handle for OPAC content (not ISO2709 part) + + This function uses iconv handle of yaz_marc_t for character set + conversion of ISO2709 part and supplied handle (cd) for OPAC part. + \*/ +YAZ_EXPORT void yaz_opac_decode_wrbuf2(yaz_marc_t mt, Z_OPACRecord *r, + WRBUF wrbuf, yaz_iconv_t cd); + /** \brief flushes records \param mt handle \param wr WRBUF for output diff --git a/src/opacdisp.c b/src/opacdisp.c index 7e96839..807ca2b 100644 --- a/src/opacdisp.c +++ b/src/opacdisp.c @@ -52,10 +52,10 @@ static void opac_element_bool(WRBUF wrbuf, int l, const char *elem, int *data) } } -void yaz_opac_decode_wrbuf(yaz_marc_t mt, Z_OPACRecord *r, WRBUF wrbuf) +void yaz_opac_decode_wrbuf2(yaz_marc_t mt, Z_OPACRecord *r, WRBUF wrbuf, + yaz_iconv_t cd) { int i; - yaz_iconv_t cd = yaz_marc_get_iconv(mt); wrbuf_puts(wrbuf, "\n"); if (r->bibliographicRecord) @@ -163,6 +163,11 @@ void yaz_opac_decode_wrbuf(yaz_marc_t mt, Z_OPACRecord *r, WRBUF wrbuf) wrbuf_puts(wrbuf, "\n"); } +void yaz_opac_decode_wrbuf(yaz_marc_t mt, Z_OPACRecord *r, WRBUF wrbuf) +{ + yaz_opac_decode_wrbuf2(mt, r, wrbuf, yaz_marc_get_iconv(mt)); +} + /* * Local variables: * c-basic-offset: 4