-
Notifications
You must be signed in to change notification settings - Fork 5
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
BUGFIX: Unicode Support #1
base: master
Are you sure you want to change the base?
Conversation
Funny, I think Matt originally was using the data param and json serializing it. I suggested using the json param to reduce the amount of the code. Does this fix the issue we were seeing? |
Another thought - the try block may be hiding any issues this change introduces. Can you put the ‘ujson.dumps().encode()’ outside the try and report back? I want to make sure that’s not the cause of your red light versus something server-side. |
A quick test with the line moved doesn't appear to change things. Will push as well. I have a stripped down version of the server (no mysql) that I was using to say can I get the json and that returns valid json. Not sure I have the app side up correctly. |
Issue server side on insert. Will look at it more tomorrow. |
I am closing this out because the DB encoding fixed the issues we were seeing. Feel free to re-open if I am incorrect. |
Reopening. After talking to @bmagistro I understand that this is required in addition to the table character set change. |
try: | ||
response = urequests.post(config.UPLOAD_URL + mac_id, json=ap_neighbors, headers={'Content-Type': 'application/json', 'User-Agent': 'WarBadge Experimental ShmooCon 2018'}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please test the following?
response = urequests.post(config.UPLOAD_URL + mac_id, json=ap_neighbors, ensure_ascii=False, headers={'Content-Type': 'application/json', 'User-Agent': 'WarBadge Experimental ShmooCon 2018'})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not look like it is posting successfully. Adding some details to the try/except, looks like it is "unexpected keyword argument ensure_ascii
". Digging into it, the ujson
library doesn't have the parameter ensure_ascii
. The library urequests
it is using usjon
to do the dump but doesn't call encode, if it did, the the json parameter would work just fine. It appears the key difference here is the .encode('utf8')
.
I put a question inline in the change set. Please look at the "Files changed" tab. |
encode the ap object before urequests to ensure the content length gets set correctly.