Catalyst::Action::Serialize::JSON with double encoding. #1

Open
wants to merge 2 commits into
from

Projects

None yet

3 participants

@thiagorondon

Make Serialize::JSON likes JSON::XS, without utf8 in _build_encoder to prevent double encoding.

Signed-off-by: Thiago Berlitz Rondon thiago.rondon@gmail.com

@thiagorondon thiagorondon Make Serialize::JSON likes JSON::XS, without utf8 in _build_encoder t…
…o prevent double encoding.

Signed-off-by: Thiago Berlitz Rondon <thiago.rondon@gmail.com>
84df9b9
@bobtfish
Owner

This should only break stuff if your data is improperly decoded in the first place, and I think it breaks things in some cases..

Can you give me a simple test or example of how the double encoding you're seeing is coming about?

@thiagorondon

Do you know why Serialize::JSON::XS extends Serialize::JSON, and override _builder_encoder without utf8 ?

@thiagorondon thiagorondon new option to put charset in content_type header.
Signed-off-by: Thiago Berlitz Rondon <thiago.rondon@gmail.com>
22c0d49
@renatocron renatocron commented on the diff Nov 13, 2012
lib/Catalyst/Action/Serialize/JSON.pm
@@ -16,7 +16,7 @@ has encoder => (
sub _build_encoder {
my $self = shift;
- return JSON->new->utf8->convert_blessed;
@renatocron
renatocron Nov 13, 2012

this is ok, there's no need to remove ->utf8

@renatocron

@bobtfish for the content type header of application/json browsers need "application/json; charset=UTF-8" (at least chrome on linux)
can you check this? you only need to check the $c->response->content_type

thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment