Open eritain opened 1 year ago
Well, not quite coincidentally. Perl adjusts its internal representations to the codepoints in the string, for backward compatibility with old code that assumes ASCII (or maybe Latin-1). Be that as it may, when you step outside that character set, HTTP::Request errors out: "HTTP::Message content must be bytes"
JSON::encode_json produces a UTF-8 encoded binary string, which is what HTTP::Request expects.
JSON::to_json produces the corresponding Unicode string, which can coincidentally be byte-identical to the binary string depending on the codepoints used and on your Perl's internal representation, but can also be something else.