From 2708edafda0b2b1a0721c432ca716391ed0a6d28 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 14 Mar 2014 16:07:11 +0100 Subject: [PATCH] Bug 11944: replace uri_escape with uri_escape_utf8 everywhere MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To reproduce, edit, index notice with صة and search "صة" Signed-off-by: Paola Rossi --- C4/Auth.pm | 2 +- C4/Search.pm | 22 +++++++++++----------- authorities/authorities-home.pl | 2 +- cataloguing/addbiblio.pl | 2 +- cataloguing/additem.pl | 2 +- members/pay.pl | 2 +- reports/guided_reports.pl | 2 +- reserve/renewscript.pl | 2 +- serials/routing-preview.pl | 2 +- serials/routing.pl | 2 +- serials/subscription-frequency.pl | 2 +- serials/subscription-numberpattern.pl | 2 +- 12 files changed, 22 insertions(+), 22 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index 44edf67..6cd72e7 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -1809,7 +1809,7 @@ sub SetSearchHistorySession { return () unless $sessionID; my $session = get_session($sessionID); return () unless $session; - $session->param('search_history', uri_escape(encode_json($search_history))); + $session->param('search_history', uri_escape_utf8(encode_json($search_history))); } END { } # module clean-up code here (global destructor) diff --git a/C4/Search.pm b/C4/Search.pm index cde1ed2..8225460 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1313,17 +1313,17 @@ sub buildQuery { if ( @limits ) { $q .= ' and '.join(' and ', @limits); } - return ( undef, $q, $q, "q=ccl=".uri_escape($q), $q, '', '', '', '', 'ccl' ); + return ( undef, $q, $q, "q=ccl=".uri_escape_utf8($q), $q, '', '', '', '', 'ccl' ); } if ( $query =~ /^cql=/ ) { - return ( undef, $', $', "q=cql=".uri_escape($'), $', '', '', '', '', 'cql' ); + return ( undef, $', $', "q=cql=".uri_escape_utf8($'), $', '', '', '', '', 'cql' ); } if ( $query =~ /^pqf=/ ) { if ($query_desc) { - $query_cgi = "q=".uri_escape($query_desc); + $query_cgi = "q=".uri_escape_utf8($query_desc); } else { $query_desc = $'; - $query_cgi = "q=pqf=".uri_escape($'); + $query_cgi = "q=pqf=".uri_escape_utf8($'); } return ( undef, $', $', $query_cgi, $query_desc, '', '', '', '', 'pqf' ); } @@ -1495,9 +1495,9 @@ sub buildQuery { $query .= " $operators[$i-1] "; $query .= " $index_plus " unless $indexes_set; $query .= " $operand"; - $query_cgi .= "&op=".uri_escape($operators[$i-1]); - $query_cgi .= "&idx=".uri_escape($index) if $index; - $query_cgi .= "&q=".uri_escape($operands[$i]) if $operands[$i]; + $query_cgi .= "&op=".uri_escape_utf8($operators[$i-1]); + $query_cgi .= "&idx=".uri_escape_utf8($index) if $index; + $query_cgi .= "&q=".uri_escape_utf8($operands[$i]) if $operands[$i]; $query_desc .= " $operators[$i-1] $index_plus $operands[$i]"; } @@ -1507,8 +1507,8 @@ sub buildQuery { $query .= " and "; $query .= "$index_plus " unless $indexes_set; $query .= "$operand"; - $query_cgi .= "&op=and&idx=".uri_escape($index) if $index; - $query_cgi .= "&q=".uri_escape($operands[$i]) if $operands[$i]; + $query_cgi .= "&op=and&idx=".uri_escape_utf8($index) if $index; + $query_cgi .= "&q=".uri_escape_utf8($operands[$i]) if $operands[$i]; $query_desc .= " and $index_plus $operands[$i]"; } } @@ -1520,8 +1520,8 @@ sub buildQuery { $query .= " $index_plus " unless $indexes_set; $query .= $operand; $query_desc .= " $index_plus $operands[$i]"; - $query_cgi .= "&idx=".uri_escape($index) if $index; - $query_cgi .= "&q=".uri_escape($operands[$i]) if $operands[$i]; + $query_cgi .= "&idx=".uri_escape_utf8($index) if $index; + $query_cgi .= "&q=".uri_escape_utf8($operands[$i]) if $operands[$i]; $previous_operand = 1; } } #/if $operands diff --git a/authorities/authorities-home.pl b/authorities/authorities-home.pl index f67f5c9..2fe4622 100755 --- a/authorities/authorities-home.pl +++ b/authorities/authorities-home.pl @@ -125,7 +125,7 @@ if ( $op eq "do_search" ) { # next/previous would not work anymore # construction of the url of each page - my $value_url = uri_escape($value); + my $value_url = uri_escape_utf8($value); my $base_url = "authorities-home.pl?" ."marclist=$marclist" ."&and_or=$and_or" diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index fa3e90b..de15c0b 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -886,7 +886,7 @@ if ( $op eq "addbiblio" ) { .'&frameworkcode='.$frameworkcode .'&circborrowernumber='.$fa_circborrowernumber .'&branch='.$fa_branch - .'&barcode='.uri_escape($fa_barcode) + .'&barcode='.uri_escape_utf8($fa_barcode) .'&stickyduedate='.$fa_stickyduedate .'&duedatespec='.$fa_duedatespec ); diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 268ef66..db56ae4 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -515,7 +515,7 @@ if ($op eq "additem") { print $input->redirect( '/cgi-bin/koha/circ/circulation.pl?' .'borrowernumber='.$fa_circborrowernumber - .'&barcode='.uri_escape($fa_barcode) + .'&barcode='.uri_escape_utf8($fa_barcode) .'&duedatespec='.$fa_duedatespec .'&stickyduedate=1' ); diff --git a/members/pay.pl b/members/pay.pl index 3e36073..dba0bad 100755 --- a/members/pay.pl +++ b/members/pay.pl @@ -172,7 +172,7 @@ sub redirect_to_paycollect { $redirect .= get_for_redirect( 'notify_id', "notify_id$line_no", 0 ); $redirect .= get_for_redirect( 'notify_level', "notify_level$line_no", 0 ); $redirect .= get_for_redirect( 'accountlines_id', "accountlines_id$line_no", 0 ); - $redirect .= q{&} . 'payment_note' . q{=} . uri_escape( $input->param("payment_note_$line_no") ); + $redirect .= q{&} . 'payment_note' . q{=} . uri_escape_utf8( $input->param("payment_note_$line_no") ); $redirect .= '&remote_user='; $redirect .= $user; return print $input->redirect($redirect); diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl index f3568f3..fe39c0e 100755 --- a/reports/guided_reports.pl +++ b/reports/guided_reports.pl @@ -743,7 +743,7 @@ elsif ($phase eq 'Run this report'){ my $totpages = int($total/$limit) + (($total % $limit) > 0 ? 1 : 0); my $url = "/cgi-bin/koha/reports/guided_reports.pl?reports=$report_id&phase=Run%20this%20report&limit=$limit"; if (@sql_params) { - $url = join('&sql_params=', $url, map { URI::Escape::uri_escape($_) } @sql_params); + $url = join('&sql_params=', $url, map { URI::Escape::uri_escape_utf8($_) } @sql_params); } $template->param( 'results' => \@rows, diff --git a/reserve/renewscript.pl b/reserve/renewscript.pl index 9293cb5..3bc539b 100755 --- a/reserve/renewscript.pl +++ b/reserve/renewscript.pl @@ -127,7 +127,7 @@ foreach my $barcode (@barcodes) { # redirection to the referrer page # if ( $input->param('destination') eq "circ" ) { - $cardnumber = uri_escape($cardnumber); + $cardnumber = uri_escape_utf8($cardnumber); print $input->redirect( '/cgi-bin/koha/circ/circulation.pl?findborrower=' . $cardnumber . $failedrenews diff --git a/serials/routing-preview.pl b/serials/routing-preview.pl index 1e0bd09..2f00531 100755 --- a/serials/routing-preview.pl +++ b/serials/routing-preview.pl @@ -133,7 +133,7 @@ $routingnotes =~ s/\n/\
/g; $template->param( title => $subs->{'bibliotitle'}, issue => $issue, - issue_escaped => URI::Escape::uri_escape($issue), + issue_escaped => URI::Escape::uri_escape_utf8($issue), subscriptionid => $subscriptionid, memberloop => $memberloop, routingnotes => $routingnotes, diff --git a/serials/routing.pl b/serials/routing.pl index 5f697ea..d7cc40b 100755 --- a/serials/routing.pl +++ b/serials/routing.pl @@ -62,7 +62,7 @@ if($op eq 'add'){ if($op eq 'save'){ my $sth = $dbh->prepare('UPDATE serial SET routingnotes = ? WHERE subscriptionid = ?'); $sth->execute($notes,$subscriptionid); - my $urldate = URI::Escape::uri_escape($date_selected); + my $urldate = URI::Escape::uri_escape_utf8($date_selected); print $query->redirect("routing-preview.pl?subscriptionid=$subscriptionid&issue=$urldate"); } diff --git a/serials/subscription-frequency.pl b/serials/subscription-frequency.pl index d8d1ec4..80c7440 100755 --- a/serials/subscription-frequency.pl +++ b/serials/subscription-frequency.pl @@ -33,4 +33,4 @@ if ($auth_status ne "ok") { my $frequencyrecord=GetSubscriptionFrequency($frqid); binmode STDOUT, ":encoding(UTF-8)"; print $input->header(-type => 'text/plain', -charset => 'UTF-8'); -print "{".join (",",map { "\"$_\":\"".uri_escape($frequencyrecord->{$_})."\"" }sort keys %$frequencyrecord)."}"; +print "{".join (",",map { "\"$_\":\"".uri_escape_utf8($frequencyrecord->{$_})."\"" }sort keys %$frequencyrecord)."}"; diff --git a/serials/subscription-numberpattern.pl b/serials/subscription-numberpattern.pl index bcb7eae..a58b10a 100755 --- a/serials/subscription-numberpattern.pl +++ b/serials/subscription-numberpattern.pl @@ -36,4 +36,4 @@ my $numpatternid=$input->param("numberpattern_id"); my $numberpatternrecord=GetSubscriptionNumberpattern($numpatternid); binmode STDOUT, ":encoding(UTF-8)"; print $input->header(-type => 'text/plain', -charset => 'UTF-8'); -print "{",join (",",map {"\"$_\":\"".(uri_escape($numberpatternrecord->{$_}) // '')."\"" }sort keys %$numberpatternrecord),"}"; +print "{",join (",",map {"\"$_\":\"".(uri_escape_utf8($numberpatternrecord->{$_}) // '')."\"" }sort keys %$numberpatternrecord),"}"; -- 1.7.10.4