diff --git a/lib/Catalyst/Action/Serialize/JSON.pm b/lib/Catalyst/Action/Serialize/JSON.pm index 9f4cf44..42ea100 100644 --- a/lib/Catalyst/Action/Serialize/JSON.pm +++ b/lib/Catalyst/Action/Serialize/JSON.pm @@ -16,7 +16,7 @@ has encoder => ( sub _build_encoder { my $self = shift; - return JSON->new->utf8->convert_blessed; + return JSON->new->convert_blessed; } sub execute { diff --git a/lib/Catalyst/Action/SerializeBase.pm b/lib/Catalyst/Action/SerializeBase.pm index 8ba1100..67718de 100644 --- a/lib/Catalyst/Action/SerializeBase.pm +++ b/lib/Catalyst/Action/SerializeBase.pm @@ -126,9 +126,16 @@ sub _load_content_plugins { } elsif ($c->request->accept_only) { $c->response->header( 'Vary' => 'Accept' ); } + $c->response->content_type($content_type); } + if ( $config->{'encoding'} ) { + my $res_content_type = $c->response->content_type; + $res_content_type .= '; charset=' . $config->{'encoding'}; + $c->response->content_type( $res_content_type ); + } + return $sclass, $sarg, $content_type; }