web/views/json.py
changeset 10700 a6d9d27f4253
parent 10666 7f6b5f023884
child 10973 0939ad2edf63
--- a/web/views/json.py	Wed Sep 16 18:43:02 2015 +0200
+++ b/web/views/json.py	Wed Sep 16 18:43:19 2015 +0200
@@ -64,7 +64,7 @@
             # use ``application/javascript`` if ``callback`` parameter is
             # provided, keep ``application/json`` otherwise
             self._cw.set_content_type('application/javascript')
-            json_data = b'%s(%s)' % (json_padding, json_data)
+            json_data = json_padding + b'(' + json_data + b')'
         return json_data
 
 
@@ -85,7 +85,8 @@
             indent = int(self._cw.form['_indent'])
         else:
             indent = None
-        self.w(json_dumps(data, indent=indent))
+        # python's json.dumps escapes non-ascii characters
+        self.w(json_dumps(data, indent=indent).encode('ascii'))
 
 
 class JsonRsetView(JsonMixIn, AnyRsetView):