I'm working on a python plugin for Google Quick Search Box, and it's doing some odd things with non-ascii characters. It seems like the code works fine up until I try constructing a string containing the non-ascii characters (ü has been my test character). I am using the following code snippet for the construction, with new_task as the variable that is being input from GQSB.
the_sig = ("%sapi_key%sauth_token%smethod%sname%sparse%stimeline%s" %
(api_secret, api_key, the_token, method, new_task, doParse, timeline))
It's giving me this error:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 0: ordinal not in range(128)
I am understanding correctly, this is because I am trying to string together a unicode character inside an ascii string. Everything I could find told me to declare the encoding at the top with this:
# -*- coding: iso-8859-15 -*-
Which I have. And when I pull the code snippet that constructs the string into a new script, it works just fine. But for some reason, int he context of the rest of the code, it fails, every time. The only thing I can think of is that it is because it's inside it's own class, but that doesn't make any sense to me.
The full code can be found on GitHub here
Thanks in advance for any help. I am stumped on this one.