Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[issue] Resolving issue 2530 with non-ASCII characters in query string #3865

Merged
merged 1 commit into from Nov 15, 2017

Conversation

john-bodley
Copy link
Member

This PR resolves issue #2530 related to having non-ascii characters in an explore query.

The actual fix was proposed by @xrmx here 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

@xrmx
Copy link
Contributor

xrmx commented Nov 14, 2017

@john-bodley i meant that there were other places where string were assumed to be ascii

Copy link
Contributor

@xrmx xrmx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer a commit title that gives some hints on what it is doing and a reference to the bug in the message but no big deal.

@john-bodley john-bodley changed the title [issue] Resolving issue 2530 [issue] Resolving issue 2530 with non-ASCII characters in query string Nov 14, 2017
@john-bodley
Copy link
Member Author

@xrmx I've updated the commit title. I agree with your comment where other strings were assumed to be ASCII. It seems there's a number of places which should apply similar logic.

@mistercrunch mistercrunch merged commit 2e25fc4 into apache:master Nov 15, 2017
michellethomas pushed a commit to michellethomas/panoramix that referenced this pull request May 24, 2018
wenchma pushed a commit to wenchma/incubator-superset that referenced this pull request Nov 16, 2018
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.21.0 labels Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.21.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants