[Koha-bugs] [Bug 25774] REST API searches don't handle correctly utf8 characters
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Wed Jun 17 05:43:43 CEST 2020
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25774
David Cook <dcook at prosentient.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dcook at prosentient.com.au
--- Comment #3 from David Cook <dcook at prosentient.com.au> ---
I don't think that this is the most elegant/maintainable solution.
If you change "decode_json" to "from_json", you shouldn't need to use
encode_utf8, since decode_json expects bytes and from_json expects a string.
By using encode_utf8, you're taking a string and turning it into bytes, when
you could just keep it as a string.
The documentation for the JSON module is pretty terrible, but I've proved this
this with the following three sample files:
{"test":"❤"}
#!/usr/bin/perl
use strict;
use warnings;
use JSON;
open(my $fh, '<', 'test.txt');
my $line = <$fh>;
my $perl = decode_json($line);
warn $perl->{test};
#!/usr/bin/perl
use strict;
use warnings;
use JSON;
open(my $fh, '<', 'test.txt');
my $line = <$fh>;
my $perl = from_json($line);
warn $perl->{test};
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list