0

I'm running Sikuli-X v2.0.5 on an Ubuntu 22.04 with lang="de_DE.UTF-8". I've some trouble to get the right text output if it has umlaute ä,ö,ü

For exemple if I try to output the text in a dialog box by

popup("Hallöchen von der Knäkente")

I get weired output where the umlaute are not displayed correctly. What I than tried is to switch to other encodeing like

pupup("Hallöchen von der Knäkente".encode("utf-8"))

But this does not work either. What do I have to use in order to get the umlaute display correctly via popup or konjunction Debug.user("text to output")

Tanks

akazen
  • 1
  • 3

1 Answers1

0

Can you try the following and let me know if it solved your problem?

At the beginning of your script add:

import sys
reload(sys)
sys.setdefaultencoding('utf-8')

Ιnstead of encoding the string with UTF-8 try passing the string to the popup.

popup("Hallöchen von der Knäkente")
  • I made a short script with the 4 lines you mentioned, but I still don't get the right output. The "ö" that should be output is represented by Ä and the paragraph sign in the popup window. – akazen Jun 06 '23 at 15:45
  • hmm.. make sure your system locale is properly set to support UTF-8. You mentioned that your Ubuntu is using de_DE.UTF-8, which should be suitable for displaying German umlauts. You can verify this by running the locale command in your terminal and checking the output. plus can you try that? popup(u"Hallöchen von der Knäkente") – George Sakkas Jun 07 '23 at 19:18
  • 1
    the locale command gives the following output: LANG=de_DE.UTF-8 LANGUAGE=de_DE:en_US:en LC_CTYPE="de_DE.UTF-8" LC_NUMERIC=de_DE.UTF-8 LC_TIME=de_DE.UTF-8 LC_COLLATE="de_DE.UTF-8" LC_MONETARY=de_DE.UTF-8 LC_MESSAGES="de_DE.UTF-8" LC_PAPER=de_DE.UTF-8 LC_NAME=de_DE.UTF-8 LC_ADDRESS=de_DE.UTF-8 LC_TELEPHONE=de_DE.UTF-8 LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=de_DE.UTF-8 LC_ALL= But the "u" in front of the text did the trick. With this I get the correct output!!!! – akazen Jun 08 '23 at 10:52
  • 1
    **but** popup(u"Hallöchen von der Knäkente") works!!! Nevertheless neigther popup("Hallöchen übern Deich von der Knäkente".encode('utf-8')) works, nor popup(u"Hallöchen übern Deich von der Knäkente".encode('utf-8')) works. So the question is, as what type of character set python interprets a string?! So I took a look at the answer [All strings meant for humans should use u"" in this post](https://stackoverflow.com/questions/2464959/whats-the-u-prefix-in-a-python-string) – akazen Jun 08 '23 at 11:04