in reply to malformed UTF-8 character in JSON string in perl
Is [there] any module other than Text::Unidecode, or a method of converting these characters like ',",-,.,? to simple ASCII characters?Why do you not want to use Text::Unidecode? It does exactly what you are requesting:
Output:use utf8; use JSON; use Encode qw(encode_utf8); use Text::Unidecode; my $data = qq( { "cat" : "text – abcd “ ’ ” ‘" } ); my $json_data = encode_utf8( $data ); my $perl_hash = decode_json( $json_data ); while ( my($k,$v) = each %$perl_hash ) { unidecode($v); print "$k => $v\n"; }
cat => text - abcd " ' " '
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: malformed UTF-8 character in JSON string in perl
by Yllar (Novice) on Aug 11, 2015 at 15:19 UTC | |
by tangent (Parson) on Aug 11, 2015 at 15:42 UTC | |
by Yllar (Novice) on Aug 11, 2015 at 15:54 UTC | |
by tangent (Parson) on Aug 11, 2015 at 16:07 UTC | |
by Anonymous Monk on Aug 11, 2015 at 16:02 UTC | |
by Anonymous Monk on Aug 11, 2015 at 16:04 UTC | |
| |
by Anonymous Monk on Aug 11, 2015 at 16:02 UTC |