LP1431541: SRU UTF8 encoding issues
authorDan Scott <dscott@laurentian.ca>
Thu, 12 Mar 2015 20:06:16 +0000 (16:06 -0400)
committerBen Shum <bshum@biblio.org>
Wed, 19 Aug 2015 03:09:37 +0000 (23:09 -0400)
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 <dscott@laurentian.ca>
Signed-off-by: Ben Shum <bshum@biblio.org>

Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm

index 873b956..521b66c 100644 (file)
@@ -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;
 }