https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25774

David Cook <dc...@prosentient.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dc...@prosentient.com.au

--- Comment #3 from David Cook <dc...@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.
_______________________________________________
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to