@@ -, +, @@ - Create a frequency and a numbering pattern with non-latin characters - Add a new subscription using these values - The screen should not contain bad encoded characters. --- serials/subscription-frequency.pl | 6 +++--- serials/subscription-numberpattern.pl | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) --- a/serials/subscription-frequency.pl +++ a/serials/subscription-frequency.pl @@ -17,12 +17,12 @@ # You should have received a copy of the GNU General Public License # along with Koha; if not, see . +use Modern::Perl; use CGI qw ( -utf8 ); use C4::Context; use C4::Serials::Frequency; use C4::Auth qw/check_cookie_auth/; -use URI::Escape; -use strict; +use JSON qw( to_json ); my $input=new CGI; my $frqid=$input->param("frequency_id"); @@ -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_utf8($frequencyrecord->{$_})."\"" }sort keys %$frequencyrecord)."}"; +print to_json( $frequencyrecord ); --- a/serials/subscription-numberpattern.pl +++ a/serials/subscription-numberpattern.pl @@ -21,7 +21,7 @@ use Modern::Perl; use CGI qw ( -utf8 ); use C4::Serials::Numberpattern; use C4::Auth qw/check_cookie_auth/; -use URI::Escape; +use JSON qw( to_json ); my $input=new CGI; @@ -34,6 +34,7 @@ if ($auth_status ne "ok") { 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_utf8($numberpatternrecord->{$_}) // '')."\"" }sort keys %$numberpatternrecord),"}"; +print to_json( $numberpatternrecord ); --