Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

encode also callback string part to octets #4

Open
wants to merge 1 commit into from

1 participant

Jozef Kutej
Jozef Kutej

Hey Miyagawa,

here is a short patch that will encode also callback string into octets to prevent $json variable from auto upgrading back to utf-8 once concatenated into $output.

Cheers
Jozef

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 24, 2012
  1. Jozef Kutej
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/Catalyst/View/JSON.pm
5 lib/Catalyst/View/JSON.pm
View
@@ -97,6 +97,11 @@ sub process {
$json = Encode::encode($encoding, $json);
}
+ # encode also callback to octets
+ if ( $cb && Encode::is_utf8($cb) ) {
+ $cb = Encode::encode($encoding, $cb);
+ }
+
$c->res->content_type("application/json; charset=$encoding");
if ($c->req->header('X-Prototype-Version') && !$self->no_x_json_header) {
Something went wrong with that request. Please try again.