summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-02-27 08:49:34 +0100
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-02-27 08:49:34 +0100
commit65255e8cff64819ee45cfcbcebb049abf4f1f756 (patch)
tree49edf1a2c212e9755bbfb03d6e3ca49b8ed2c5a6 /Bugzilla
parent083187a278885e313042bb3c33ef7de02187f3b4 (diff)
downloadbugzilla-65255e8cff64819ee45cfcbcebb049abf4f1f756.tar.gz
bugzilla-65255e8cff64819ee45cfcbcebb049abf4f1f756.tar.xz
Bug 547601: Make the JSON-RPC interface return UTF-8 data correctly.
r=dkl, a=mkanat
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/WebService/Server/JSONRPC.pm14
1 files changed, 12 insertions, 2 deletions
diff --git a/Bugzilla/WebService/Server/JSONRPC.pm b/Bugzilla/WebService/Server/JSONRPC.pm
index cc3e8058e..35eda1af1 100644
--- a/Bugzilla/WebService/Server/JSONRPC.pm
+++ b/Bugzilla/WebService/Server/JSONRPC.pm
@@ -35,13 +35,23 @@ sub new {
Bugzilla->_json_server($self);
$self->dispatch(WS_DISPATCH);
$self->return_die_message(1);
- $self->json->allow_blessed(1);
- $self->json->convert_blessed(1);
# Default to JSON-RPC 1.0
$self->version(0);
return $self;
}
+sub create_json_coder {
+ my $self = shift;
+ my $json = $self->SUPER::create_json_coder(@_);
+ $json->allow_blessed(1);
+ $json->convert_blessed(1);
+ # This may seem a little backwards, but what this really means is
+ # "don't convert our utf8 into byte strings, just leave it as a
+ # utf8 string."
+ $json->utf8(0) if Bugzilla->params->{'utf8'};
+ return $json;
+}
+
# Override the JSON::RPC method to return our CGI object instead of theirs.
sub cgi { return Bugzilla->cgi; }