From 45bf7a223153a11dcc07b1f1cb988f02af3a23f1 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 8 Mar 2011 13:28:10 +0100 Subject: [PATCH] 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. --- include/yaz/marcdisp.h | 15 +++++++++++++++ src/opacdisp.c | 9 +++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) 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 -- 1.7.10.4