use OpenILS::Const qw/:const/;
use Unicode::Normalize;
use OpenSRF::Utils::SettingsClient;
+use Encode;
# ---------------------------------------------------------------------------
# Pile of utilty methods used accross applications.
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 {
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:#) {