cabo40 commented on a change in pull request #13830:
URL: https://github.com/apache/superset/pull/13830#discussion_r609115296



##########
File path: superset/views/core.py
##########
@@ -2211,7 +2211,8 @@ def results_exec(  # pylint: 
disable=too-many-return-statements
             obj = apply_display_max_row_limit(obj, rows)
 
         return json_success(
-            json.dumps(obj, default=utils.json_iso_dttm_ser, ignore_nan=True)
+            json.dumps(obj, default=utils.json_iso_dttm_ser, ignore_nan=True,
+                       encoding=None)

Review comment:
       Hi!
   Thanks for checking the PR. I looked into the encoding and it seems that if 
a utf-8 string is in the json as a binary string, it will pass through 
https://github.com/apache/superset/blob/b5c95c537c6cefb3e36eac8b82625565a5152a8a/superset/utils/core.py#L550
 and get encoded into `utf-8`, and if the string is a `str` it will go through 
https://github.com/simplejson/simplejson/blob/8bef979ad8272cbc2903970f4b9992f603d50973/simplejson/encoder.py#L51
 and also get encoded into `utf-8`.
   There are two other places where the dump is done with `encoding=None`:
   
https://github.com/apache/superset/blob/b5c95c537c6cefb3e36eac8b82625565a5152a8a/superset/views/core.py#L2302
   
https://github.com/apache/superset/blob/b5c95c537c6cefb3e36eac8b82625565a5152a8a/superset/views/core.py#L2428
   I also think that the other calls to json.dumps with `default=utils.*` 
should have encoding set to `None`.
   I did a brief test of the change with non ASCII strings and they were 
correctly displayed.
   Is there some other test you think could help mitigate the risk of querying 
non ASCII chars?
   Cheers :)
   
![image](https://user-images.githubusercontent.com/1605852/113943364-2a11e000-97c8-11eb-8e5c-f4642f99bafc.png)
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to