From 273aca936c4fbaa79a8fbba96bae285705c558fc Mon Sep 17 00:00:00 2001 From: Andrew Isherwood Date: Thu, 6 Feb 2020 11:08:41 +0000 Subject: [PATCH] Bug 23173: (follow-up) Allow for wide characters The conversion of the metadata into Base64 for passing in the API call to the plugin API routes was failing if the metadata contained a wide character, so we now encode it into UTF-8 first --- Koha/Illrequest/Availability.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Koha/Illrequest/Availability.pm b/Koha/Illrequest/Availability.pm index 099f88596e..a9ca6efd4d 100644 --- a/Koha/Illrequest/Availability.pm +++ b/Koha/Illrequest/Availability.pm @@ -21,7 +21,8 @@ use Modern::Perl; use JSON; use MIME::Base64 qw( encode_base64 ); -use URI::Escape qw ( uri_escape ); +use URI::Escape qw( uri_escape ); +use Encode qw( encode ); use Koha::Plugins; @@ -114,7 +115,7 @@ sub prep_metadata { # so this function returns something predictable that we can test! my $json = JSON->new; $json->canonical([1]); - return uri_escape(encode_base64($json->encode($metadata))); + return uri_escape(encode_base64(encode('utf-8',$json->encode($metadata)))); } =head1 AUTHOR -- 2.11.0