Cpanel-JSON-XS
view release on metacpan or search on metacpan
generate and expect Unicode strings, that is, characters with high
ordinal Unicode values (> 255) will be encoded as such characters,
and likewise such characters are decoded as-is, no changes to them
will be done, except "(re-)interpreting" them as Unicode codepoints
or Unicode characters, respectively (to Perl, these are the same
thing in strings unless you do funny/weird/dumb stuff).
This is useful when you want to do the encoding yourself (e.g. when
you want to have UTF-16 encoded JSON texts) or when some other layer
does the encoding for you (for example, when printing to a terminal
using a filehandle that transparently encodes to UTF-8 you certainly
do NOT want to UTF-8 encode your data first and have Perl encode it
another time).
"utf8" flag enabled
If the "utf8"-flag is enabled, "encode"/"decode" will encode all
characters using the corresponding UTF-8 multi-byte sequence, and
will expect your input strings to be encoded as UTF-8, that is, no
"character" of the input string must have any value > 255, as UTF-8
does not allow that.
and expect Unicode strings, that is, characters with high ordinal Unicode
values (> 255) will be encoded as such characters, and likewise such
characters are decoded as-is, no changes to them will be done, except
"(re-)interpreting" them as Unicode codepoints or Unicode characters,
respectively (to Perl, these are the same thing in strings unless you do
funny/weird/dumb stuff).
This is useful when you want to do the encoding yourself (e.g. when you
want to have UTF-16 encoded JSON texts) or when some other layer does
the encoding for you (for example, when printing to a terminal using a
filehandle that transparently encodes to UTF-8 you certainly do NOT want
to UTF-8 encode your data first and have Perl encode it another time).
=item C<utf8> flag enabled
If the C<utf8>-flag is enabled, C<encode>/C<decode> will encode all
characters using the corresponding UTF-8 multi-byte sequence, and will
expect your input strings to be encoded as UTF-8, that is, no "character"
of the input string must have any value > 255, as UTF-8 does not allow
that.
( run in 0.719 second using v1.01-cache-2.11-cpan-0a6323c29d9 )