Trying to type non-ascii characters with "paste(ucode(text))" is raising the UnicodeEncodeError Exception

Asked by edlothiad on 2017-12-04

I'm trying to type the following line:

type("§§§" + Key.ENTER)

After searching on here I found out about the "paste(ucode(text))", however after trying that I got stuck with the same error, notably:

IDE: (org.sikuli.scriptrunner.JythonScriptRunner@259dd9ac).runScript: Exception: UnicodeEncodeError: 'ascii' codec can't encode characters in position 152-157: ordinal not in range(128)

I've looked around on the internet but to no avail.

Help would be appreciated.

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
2017-12-05
Last query:
2017-12-05
Last reply:
2017-12-04
RaiMan (raimund-hocke) said : #1

just use

paste("§§§")
type(Key.ENTER)

Best RaiMan (raimund-hocke) said : #2

Sorry, 2fast4me ;-)

paste(ucode("§§§"))

is the correct use.
Make sure, you are running at least version 1.1.1

edlothiad (edlothiad) said : #3

Thanks RaiMan, that solved my question.