We were having some problems with UTF-8 output via
Catalyst::Action::Serialize::JSONP which Catalyst::Controller::REST
uses for JSONP output.  Basically, unicode data was not being read
correctly by browsers when read via JSONP, whereas it was fine as
JSON.

A solution that worked for us was to edit
Catalyst::Action::Serialize::JSONP and add "; charset=utf-8" to the
content type header:

$c->res->content_type('text/javascript; charset=utf-8');

My guess is that browsers treat text/javascript content differently
than application/json content and require the addition of the charset
to the content-type to read it correctly.

Does this seems like a reasonable solution to our problem?  Is there a
better way?

Thanks!
Jim

_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to