[open-ils-commits] r20112 - trunk/Open-ILS/src/perlmods/lib/OpenILS/WWW (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Apr 15 16:13:51 EDT 2011


Author: dbs
Date: 2011-04-15 16:13:46 -0400 (Fri, 15 Apr 2011)
New Revision: 20112

Modified:
   trunk/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm
Log:
Protect dumb JavaScript engines from having to deal with actual Unicode

The holdings_xml format did not include an XML declaration, but adding that
as we do here still does not make the Firefox and Chromium JS engines capable
of consuming XML that contains Unicode content outside of the base ASCII
range.

So, we invoke entityize() to convert anything outside of the realm of
ASCII to XML entities. An alternative would be to invoke entityize() in
OpenILS::Application::SuperCat::unAPI::acn but it's not clear if that
would interfere with any other uses.

With this change, library names / copy location names with Unicode content
can be displayed correctly on the search results page.


Modified: trunk/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm	2011-04-15 19:41:27 UTC (rev 20111)
+++ trunk/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm	2011-04-15 20:13:46 UTC (rev 20112)
@@ -680,12 +680,19 @@
         return 404;
     }
 
-    print "Content-type: application/xml; charset=utf-8\n\n$data";
+    print "Content-type: application/xml; charset=utf-8\n\n";
 
+    # holdings_xml format comes back to us without an XML declaration
+    # and without being entityized; fix that here
     if ($base_format eq 'holdings_xml') {
+        print "<?xml version='1.0' encoding='UTF-8' ?>\n";
+        print $U->entityize($data);
+
         while (my $c = $req->recv) {
-            print $c->content;
+            print $U->entityize($c->content);
         }
+    } else {
+        print $data;
     }
 
     return Apache2::Const::OK;



More information about the open-ils-commits mailing list