0

I have a Sikuli/Python Script that works very good.
Since I am Dutch we have the same letters in our alphabet as the English alphabet.

Now there is however one letter that we have that does not occur in the alphabet, but that is used in Dutch grammar.
The ë.
Now Sikuli falls over it becuase it doesn't belong in the English alphabet.
We also have Belgium custumers that might use French on it in the future.

How can I make that all my Scripts look at UTF-8, and not at ASCII (what seems to be the default)?

Tenzin
  • 2,415
  • 2
  • 23
  • 36
  • `ë` doesn't belong in the *ASCII characterset*. It has [uses in English as well](http://en.wikipedia.org/wiki/%C3%8B#English). – Martijn Pieters Apr 01 '15 at 13:07
  • Can you define *falls over* in more detail? Do you get an error message? If so, what is that message? Can you provide *code* that reproduces the issue? Have you tried using Unicode strings rather than byte strings? – Martijn Pieters Apr 01 '15 at 13:08
  • 2
    And if you are expecting your module to include utf-8 chars, you just have to mention it on the very top `# -*- coding: utf-8 -*-` – Tanveer Alam Apr 01 '15 at 13:09
  • possible duplicate of [Working with utf-8 encoding in Python source](http://stackoverflow.com/questions/6289474/working-with-utf-8-encoding-in-python-source) – neiesc Apr 01 '15 at 13:09
  • 4
    And I suspect that you could do with a quick Python - and - Unicode primer: read [this article](http://www.joelonsoftware.com/articles/Unicode.html) and then [this one too](http://nedbatchelder.com/text/unipain.html), topped off with a dash of [this one](https://docs.python.org/2/howto/unicode.html). – Martijn Pieters Apr 01 '15 at 13:09
  • 1
    Looks related: [Special characters in Sikuli script](http://stackoverflow.com/q/10698380) – Martijn Pieters Apr 01 '15 at 13:11
  • And now that you have more jargon, look at [this google search](https://www.google.co.uk/webhp#q=sikuli%20unicode) for further research. – Martijn Pieters Apr 01 '15 at 13:11
  • The # -*- coding: utf-8 -*- seems to do the trick for both versions. Also in Sikuli 1.1.0 I don't get any errors on it, but with Sikuli 1.0.1 I do. Weird. Thanks for the help. – Tenzin Apr 01 '15 at 13:13

1 Answers1

1

In order to specify that your module shall include utf-8 encoding, use this encoding declaration in the header or footer of your file, as per PEP 0263:

# -*- coding: utf-8 -*-
miradulo
  • 28,857
  • 6
  • 80
  • 93