[Catalyst] UTF-8 with Catalyst::Controller::REST and JSON::Syck
jshirley at gmail.com
Mon Dec 15 17:37:24 GMT 2008
On Mon, Dec 15, 2008 at 9:09 AM, Francesc Romà i Frigolé
<francesc.roma+catalyst at gmail.com> wrote:
> I have a controller which derives from Catalyst::Controller::REST, and
> my data is in UTF-8 format. When I deserialize with JSON the data is
> not displayed properly. Everything else works fine with utf-8:
> deserialization in xml works, and non-restful controllers work as
> According to the manual Catalyst::Controller::REST uses JSON::Syck for
> json serialization, but when I try to access variables like
> $JSON::Syck::ImplicitUnicode or $JSON::Syck::SingleQuote from within
> my controller they are undefined.
> How can I make a restful controller send utf-8 encoded data?
Catalyst::Controller::REST actually just uses JSON.pm now... that Pod
just missed an update (unfortunately). Sorry for the confusion there.
JSON.pm will use JSON::XS if available, and failing that use a
pure-Perl implementation. Can you check your JSON and JSON::XS
versions, and if possible write a failing test case for the utf-8 data
if it still isn't working? I'll get a patch in to fix the pod, and
would like to fix any unicode/utf-8 issues that happen with the code
(though to my knowledge I don't think there should be any, and I am
using some JSON+UTF-8 combinations in my applications)
More information about the Catalyst