john-bodley opened a new pull request #3865: [issue] Resolving issue 2530
URL: https://github.com/apache/incubator-superset/pull/3865
 
 
   This PR resolves issue 
[#2530](https://github.com/apache/incubator-superset/issues/2530) related to 
having non-ascii characters in an explore query.
   
   The actual fix was proposed by @xrmx 
[here](https://github.com/apache/incubator-superset/issues/2530#issuecomment-293191532)
 which remedies the problem in Python2 given that `str(...)` uses the ASCII 
codec, i.e., 
   ```
   >>> str(u'Andaluc?a')
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
   UnicodeEncodeError: 'ascii' codec can't encode character u'\xed' in position 
7: ordinal not in range(128)
   ```
   The fix is to use `six.text_type(...)` which calls `unicode(...)` in Python 
2 and `str(...)` in Python 3.
   ```
   >>> unicode(u'Andaluc?a')
   u'Andaluc\xeda'
   ```
   @xrmx I don't fully understand your comment, 
   > but the code is still broken with non-ascii chars on python2
   as the problem seems to be specific to Python 2 and using 
`six.text_type(...)` remedies the problem.
   
   ![screen shot 2017-11-14 at 11 38 26 
am](https://user-images.githubusercontent.com/4567245/32800876-5f45c490-c930-11e7-84e6-51a45a2c5477.png)
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to