John Napiorkowski <[email protected]> writes: > So what it looks like to me is that the code that sets a content > length if one is not set by the view is not dealing with unicode > correctly. I have another unicode issue I need to look at soonish so I > try to see if we can get a test case for this. -jnap > sub index :Path :Args(0) > { > my ( $self, $c ) = @_; > > my $json_text = '{"id":1, "msg":"В Питере пить"}'; > $c->response->content_type('application/json'); > $c->response->body($json_text); > } >
The content type "application/json" is not encoded by catalyst, because most of the serializers prefer to output bytes not characters (with the, good or wrong, reason that json is data, not text). There you are storing a decoded string, declaring the content type, and serve the body. Which of course is not going to work. https://metacpan.org/pod/Catalyst#ENCODING It says: If you are producing JSON response in an unconventional manner (such as via a template or manual strings) you should perform the UTF8 encoding manually as well such as to conform to the JSON specification. And setting the json manually *is* an unconventional manner. I hope this helps. Best wishes -- Marco _______________________________________________ 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/
