Use dotted characters in Windows

Asked by Akos Kovacs on 2019-01-15

I have strings, which contains following dotted characters: "áéöüóőúű". I try to use paste() method to put it to field.

I found solution ALT key codes, but I don't know where these characters located in string.
I found paste(unicode()) method, but it isn't present in newest SNAPSHOT version.

Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Solved by:
Manfred Hampl
Last query:
Last reply:
RaiMan (raimund-hocke) said : #1

it is
paste(ucode("some text with unicode characters"))

paste(unicd("some text with unicode characters"))

Akos Kovacs (plaidshirtakos) said : #2

I tried it, but got: [error] NoMethodError ( (NoMethodError) undefined method `unicd' for main:Object )

RaiMan (raimund-hocke) said : #3

since I cannot see, how you run your script (a main is not needed for SikuliX scripts), I cannot tell you what your problem is.

ucode() and unicd() are defined in, which is auto-imported if you run the script in the SikuliX-style.

In other cases you might need
from sikuli import *

Akos Kovacs (plaidshirtakos) said : #4

I use SikuliXIDE 1.1.4-SNAPSHOT.

RaiMan (raimund-hocke) said : #5

this does what it should:


in Notepad window there is then:

Akos Kovacs (plaidshirtakos) said : #6

I see, but there are more than one inut fields in that application. Input field is already in focus in my script.

Akos Kovacs (plaidshirtakos) said : #7

Please check image:

Manfred Hampl (m-hampl) said : #8

You probably need certain require/include statements.
I suggest you look at

Akos Kovacs (plaidshirtakos) said : #9

@Manfred Hampl: I added require 'Lib/sikulix' and include Sikulix, but got same error message.

RaiMan (raimund-hocke) said : #10

Sorry, didnot See that it is Ruby.
In IDE no additional require/inclusive needed.

... but the mentioned functions are only available in Python scripting.

You have to find out how to encode an utf8 string

Akos Kovacs (plaidshirtakos) said : #11

@RaiMan : Bad news :( Could you offer some ways please, how could I implement it?

TestMechanic (ndinev) said : #12

Hi Akos,

I have one idea that can help you.

Lets imagine you have 2 keyboard layout installed. I have English and Bulgarian. The hot key for switching is windows key + space key.

The idea is to switch between languages and type in English with key that will produce your desired output. Here is example in Cyrillic but will work for any language

# staring with English

# now switch to your second language
type(Key.SPACE, KeyModifier.WIN)

# type Latin letters that correspond to your second language letters

Here is the video demonstrating above approach -
Note in the bottom-right corner the language indicator

Hope this helps

Akos Kovacs (plaidshirtakos) said : #13

@TestMechanic : I can't use type(). because computer behaves weird after command is executed. Unable to take a single click after that.

Best Manfred Hampl (m-hampl) said : #14

Where do these strings come from?

What happens if you try the simple paste("áéöüóőúű") statement? gives some hints about character encoding conversation in Ruby (hopefully also applicable to JRuby).

Maybe one of these works:
paste("áéöüóőúű".force_encoding("ISO-8859-1") .encode("UTF-8"))
or something similar.

TestMechanic (ndinev) said : #15


So you cannot execute even type('test') in pure English?

Akos Kovacs (plaidshirtakos) said : #16

@TestMechanic: I can, that is ok.
@Manfred Hampl: Strings are pathes and come from a txt file. If I paste those dotted characters I get non-readable characters in field. I already tried these practices, but has same or very similar effect. Path is pasted in a modified format.

Manfred Hampl (m-hampl) said : #17

Which encoding does the text file with the path names really have?

Which operating system and program was used for creating this text file?

What happens if you try opening this file in Microsoft Word, and play around with the different encoding possibilities, which one do you have to select that you get a correct preview in the import window?

Maybe you need other encodings, perhaps

Akos Kovacs (plaidshirtakos) said : #18

@Manfred Hampl: Text file has ANSI encoding. It was created with command prompt, it is output of a command. I opened it in Notepad++, but all other encodings contain not readable characters, if I change it.

I already tried that code, but doesn't worked for me, I got unreadable characters in form.

Manfred Hampl (m-hampl) said : #19

For an attempt to find the real encoding scheme, can you provide the values of "á".bytes, "é".bytes, "ö".bytes, ...

Akos Kovacs (plaidshirtakos) said : #20

@Manfred Hampl: Thanks a lot for your help, that line: paste(myPathname.force_encoding("Windows-1252").encode("UTF-8")) helped me a lot to find solution, just changed encoding values and it is correct!

Akos Kovacs (plaidshirtakos) said : #21

Thanks Manfred Hampl, that solved my question.