leuce Posted November 19, 2016 Posted November 19, 2016 (edited) Hello everyone I'm using InetRead to send queries to a Google API, and from the results it appears that characters like ë, ö, á, ê etc are silently dropped from the URL when it is sent to Google. So if I paste the URL https://www.googleapis.com/language/translate/v2?key=APIKEY&source=af&target=en&pasiënt in my browser, then I get the correct response (i.e. the translation of "pasiënt"). But if I use InetRead to send the URL, then the response that I get from Google makes me think that "pasint" was sent. So... can InetRead handle characters like ë, ö, á, ê etc? If not, is there a way to make it? On the same note, can InetRead handle URLs with, say, Arabic or Cyrillic characters in it? Thanks Samuel PS. I attach the actual script here in case anyone wants to see it. simplegoog v5 ###.au3 Edited November 19, 2016 by leuce
InunoTaishou Posted November 19, 2016 Posted November 19, 2016 I think your web browser is implicitly converting the unicode character to the proper escaped character that can be queried. When you google search ë it's converted to %C3%AB. (Copy the url from your browser and into notepad, your browser converts it back to unicode for your view, but the copied url will be the %C3%AB) Idk what C3 is, try googling how to work with unicode characters in the google api.
leuce Posted November 19, 2016 Author Posted November 19, 2016 (edited) Thanks, I was already halfway to a solution but was missing one small piece of the puzzle, which you provided by telling me that ë is %C3%AB (UTF8) instead of %FD%FF (UTF16LE). Now my little script also works with Arabic, Russian, etc. Updated script attached. simplegoog v5 ###.au3 Edited November 19, 2016 by leuce
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now