post updated: JSON::XS produces "valid" utf-8, and JSON does not. | [reply] |
"does not" is one of most vague problem descriptions; right up there with "doesn't work".
A Perl module that produces JSON has two valid choices of what to output: 1) A UTF-8 string that has been tagged as being UTF-8 (from Perl's perspective). 2) A UTF-8 string encoded as a sequence of bytes from Perl's perspective [same as (1) just without the "is utf-8" flag set].
Your code presumes only one of those possibilities. I know that JSON::XS defaults to returning (1) but can be asked to return (2). I haven't looked into what JSON::PP gives.
When dealing with UTF-8 problems in Perl, it is best to use Devel::Peek.
| [reply] |
| [reply] |