in reply to Re^2: malformed UTF-8 character in JSON string in perl
in thread malformed UTF-8 character in JSON string in perl

I know it is not a regular dash, and I didn't have a regular dash in my 3 examples above, as it can be seen in the first one with Data Dumper (showing the escape sequence), and also in the second one displaying the warning about wide character.

This is the same example with first one regular dash and then an "irregular" one, using first Data Dumper to show the UTF-8 escape sequence on the irregular dash, and showing what I get with binmode:

$ perl -e ' use strict; use warnings; use utf8; use Data::Dumper; my $data = "regular dash - other type of beast: – abcd"; print Dumper $data; binmode STDOUT, ":utf8"; print "$data"; ' $VAR1 = "regular dash - other type of beast: \x{2013} abcd"; regular dash - other type of beast: – abcd
If this does not work for you and it does for me, I would suspect that either your version of Perl is too old (I am using 5.14) or that there is something wrong in your terminal configuration.

Replies are listed 'Best First'.
Re^4: malformed UTF-8 character in JSON string in perl
by Yllar (Novice) on Aug 11, 2015 at 16:00 UTC

    Hi Laurent_R

    I really do not understand why it is not working for me. I am using perl 5, version 12, subversion 2.