Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

thiagorondon
Copy link

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

Signed-off-by: Thiago Berlitz Rondon [email protected]

…o prevent double encoding.

Signed-off-by: Thiago Berlitz Rondon <[email protected]>
@bobtfish
Copy link
Owner

bobtfish commented Feb 8, 2012

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
Copy link
Author

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

@@ -16,7 +16,7 @@ has encoder => (

sub _build_encoder {
my $self = shift;
return JSON->new->utf8->convert_blessed;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@renatocron
Copy link

@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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants