From 7c640b64b089cd19d737cee1e45d5af82524d6ae Mon Sep 17 00:00:00 2001 From: dbs Date: Fri, 11 Mar 2011 16:42:01 +0000 Subject: [PATCH] Ensure incoming query values to patron search are UTF8-encoded Addresses the problem reported with searching for patrons with Armenian names, where Unicode query params were getting corrupted on its way to the database. git-svn-id: svn://svn.open-ils.org/ILS/trunk@19697 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../lib/OpenILS/Application/Storage/Publisher/actor.pm | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/actor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/actor.pm index 22362cf53c..212dd4587b 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/actor.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/actor.pm @@ -10,8 +10,9 @@ use DateTime; use DateTime::Format::ISO8601; use DateTime::Set; use DateTime::SpanSet; - - + +use Encode; + my $_dt_parser = DateTime::Format::ISO8601->new; my $log = 'OpenSRF::Utils::Logger'; @@ -643,15 +644,15 @@ sub patron_search { # group 3 = barcode my $usr = join ' AND ', map { "LOWER(CAST($_ AS text)) ~ ?" } grep { ''.$$search{$_}{group} eq '0' } keys %$search; - my @usrv = map { "^$$search{$_}{value}" } grep { ''.$$search{$_}{group} eq '0' } keys %$search; + my @usrv = map { "^" . encode_utf8($$search{$_}{value}) } grep { ''.$$search{$_}{group} eq '0' } keys %$search; my $addr = join ' AND ', map { "LOWER(CAST($_ AS text)) ~ ?" } grep { ''.$$search{$_}{group} eq '1' } keys %$search; - my @addrv = map { "^$$search{$_}{value}" } grep { ''.$$search{$_}{group} eq '1' } keys %$search; + my @addrv = map { "^" . encode_utf8($$search{$_}{value}) } grep { ''.$$search{$_}{group} eq '1' } keys %$search; - my $pv = $$search{phone}{value}; - my $iv = $$search{ident}{value}; - my $nv = $$search{name}{value}; - my $cv = $$search{card}{value}; + my $pv = encode_utf8($$search{phone}{value}); + my $iv = encode_utf8($$search{ident}{value}); + my $nv = encode_utf8($$search{name}{value}); + my $cv = encode_utf8($$search{card}{value}); my $card = ''; if ($cv) { -- 2.11.0