From 81e6929fc81edabe254cefd782e88c3e4bb81e12 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Thu, 12 Mar 2015 16:06:16 -0400 Subject: [PATCH] LP1431541: SRU UTF8 encoding issues The SuperCat SRU service was encoding MARCXML using an encode_utf8() call that ended up corrupting non-ASCII characters. In addition, the HTTP header charset was not being set, meaning that the return header would default to ISO-8859-1. Signed-off-by: Dan Scott Signed-off-by: Ben Shum --- Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm index 873b956498..521b66c32c 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm @@ -1969,8 +1969,7 @@ sub sru_search { } } - # Ensure the data is encoded as UTF8 before we hand it off - $marcxml = encode_utf8($marc->as_xml_record()); + $marcxml = $marc->as_xml_record(); $marcxml =~ s/^<\?xml version="1.0" encoding="UTF-8"\?>//o; } @@ -1999,7 +1998,7 @@ sub sru_search { ); } - print $cgi->header( -type => 'application/xml' ); + print $cgi->header( -type => 'application/xml', -charset => 'UTF-8' ); print $U->entityize($resp->asXML) . "\n"; return Apache2::Const::OK; } @@ -2116,7 +2115,7 @@ sub sru_auth_search { ); } - print $cgi->header( -type => 'application/xml' ); + print $cgi->header( -type => 'application/xml', -charset => 'UTF-8' ); print $U->entityize($resp->asXML) . "\n"; return Apache2::Const::OK; } -- 2.43.2