From 1c016176341be0197d1978e3b4ee0e6c5136c319 Mon Sep 17 00:00:00 2001 From: emilyrose Date: Fri, 22 Sep 2023 11:58:23 -0400 Subject: [PATCH] Bug 34870: Perform UTF8 encoding before redirection MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Display special characters correctly when writing off an invoice. The issue arises because pay.pl does not perform UTF-8 encoding on the “notes” parameter before redirecting the page. By using uri_escape_utf8, characters with a code above 255 are also UTF-8 encoded. Then, paycollect.pl can collect the information without any trouble. This patch work with “;” and “:” characters. TEST PLAN 1) Go to any patron profile > Accounting 2) Click “Create manual invoice” 3) Fill the fields and click the “Save” button 4) Repeat steps 2 and 3 5) Click “Make a payment” 6) Add a note with special characters for each one (e.g., éçö) 7) Select the created invoices and click the “Write off selected” button 8) In the note field, you should see “�” symbols where the special characters are supposed to be 9) Click the “Cancel” button 10) Now add a note with “:;” for one of the invoices 11) Select the invoices and click the “Write off selected” button 12) You should see a page with an error 500 13) Go back to the “Make a payment” page 14) Apply the patch 15) Add a note with special characters for each one (e.g., éçö) 16) Add “:;” to one of the note fields 17) Select the invoices and click the “Write off selected” button 18) Now the special characters are displayed correctly Signed-off-by: David Nind Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi --- members/pay.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/members/pay.pl b/members/pay.pl index adc34b37c3..19ab74bdc3 100755 --- a/members/pay.pl +++ b/members/pay.pl @@ -280,7 +280,8 @@ sub payselected { } $amt = '&amt=' . $amt; my $sel = '&selected=' . join ',', @lines_to_pay; - my $notes = '¬es=' . join("%0A", map { scalar $input->param("payment_note_$_") } @lines_to_pay ); + my $notes = + '¬es=' . uri_escape_utf8( join( "\n", map { scalar $input->param("payment_note_$_") } @lines_to_pay ) ); my $redirect = "/cgi-bin/koha/members/paycollect.pl?borrowernumber=$borrowernumber" . "&type=$type" -- 2.39.5