[open-ils-commits] r15388 - in branches/rel_1_6/Open-ILS/src/perlmods/OpenILS: Application WWW (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Jan 26 12:17:22 EST 2010


Author: dbs
Date: 2010-01-26 12:17:18 -0500 (Tue, 26 Jan 2010)
New Revision: 15388

Modified:
   branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm
   branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
Log:
Backport r15319 and r15320 from trunk to fix SRU/Z39.50 searches for diacritics


Modified: branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm
===================================================================
--- branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm	2010-01-26 16:35:37 UTC (rev 15387)
+++ branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm	2010-01-26 17:17:18 UTC (rev 15388)
@@ -13,6 +13,7 @@
 use OpenILS::Const qw/:const/;
 use Unicode::Normalize;
 use OpenSRF::Utils::SettingsClient;
+use Encode;
 
 # ---------------------------------------------------------------------------
 # Pile of utilty methods used accross applications.
@@ -1474,6 +1475,10 @@
     my($self, $string, $form) = @_;
 	$form ||= "";
 
+	# If we're going to convert non-ASCII characters to XML entities,
+	# we had better be dealing with a UTF8 string to begin with
+	$string = decode_utf8($string);
+
 	if ($form eq 'D') {
 		$string = NFD($string);
 	} else {

Modified: branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
===================================================================
--- branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm	2010-01-26 16:35:37 UTC (rev 15387)
+++ branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm	2010-01-26 17:17:18 UTC (rev 15388)
@@ -1640,9 +1640,14 @@
 	my ($shortname, $holdings) = $url =~ m#/?([^/]*)(/holdings)?#;
 
 	if ( $resp->type eq 'searchRetrieve' ) {
-		my $cql_query = decode_utf8($req->query);
-		my $search_string = decode_utf8($req->cql->toEvergreen);
 
+		# These terms are arriving to us double-encoded, so until we
+		# figure out where in the CGI/SRU chain that's happening, we
+		# have to # forcefully double-decode them a second time with
+		# the outer decode('utf8', $string) call
+		my $cql_query = decode('utf8', decode_utf8($req->query));
+		my $search_string = decode('utf8', decode_utf8($req->cql->toEvergreen));
+
 		# Ensure the search string overrides the default site
 		if ($shortname and $search_string !~ m#site:#) {
 			$search_string .= " site:$shortname";



More information about the open-ils-commits mailing list