I have a pretty simple script in Perl:
use JSON; use open qw/ :std :encoding(utf8) /; #my $ref = JSON::decode_json($json_contents); my $path = "/home/chambres/web/x.org/public_html/cgi-bin/links/admin/booking_import/import/file.json"; my $json_contents = slurp_utf8_file($path); my $ref = JSON->new->utf8->decode($json_contents); sub slurp_utf8_file { my @back; #open my $in, '<:encoding(UTF-8)', $_[0] or die $!; open my $in, "<$_[0]" or die $!; while (<$in>) { push @back, $_ } close ($in); return join("", @back); } The file is encoded in UTF-8 in Notepad++:
...yet when I run my script I get:
perl test.cgi Wide character in subroutine entry at test.cgi line 11. Line 11 is:
my $ref = JSON->new->utf8->decode($json_contents); I'm baffled as to what I'm doing wrong. Maybe I just need a break! Any advice would be much appreciated!

->utf8on the JSON object?