khrt / Raisin

Raisin - a REST API micro framework for Perl 🐫 🐪
62 stars 31 forks source link

Encoder/Decoder are unable to cope with UTF-8 / wide characters. #88

Closed mschout closed 5 years ago

mschout commented 5 years ago

The YAML and JSON encoder/decoder modules are unable to cope with wide characters (on encode), and do not decode UTF-8 on decode (or input).

RFC 7159 specifys the default JSON format should be UTF-8, so it makes sense to default to UTF-8.

There is no YAML RFC that I am aware of, but YAML::XS defaults to UTF-8 for example. YAML on the other hand seems to produce characters not bytes. We may need to work around that or do some kind of detection if YAML::XS is installed, use it, otherwise fall back to YAML::PP.

Currently the YAML encoder blows up with encountering wide characters.

I have a PR coming that will address this.