[open-ils-commits] r19699 - branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Mar 11 11:46:17 EST 2011
Author: dbs
Date: 2011-03-11 11:46:15 -0500 (Fri, 11 Mar 2011)
New Revision: 19699
Modified:
branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/actor.pm
Log:
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.
Modified: branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/actor.pm
===================================================================
--- branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/actor.pm 2011-03-11 16:42:54 UTC (rev 19698)
+++ branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/actor.pm 2011-03-11 16:46:15 UTC (rev 19699)
@@ -10,8 +10,9 @@
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 @@
# 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) {
More information about the open-ils-commits
mailing list