← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #180803]: paste() function with unicode fails

 

Question #180803 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/180803

    Status: Open => Answered

RaiMan proposed the following answer:
--- talking about the Jython level of Sikuli

評價很高耶!! 不過價錢真的很貴

The above line was produced here from Sikuli IDE by using:

x = "評價很高耶!! 不過價錢真的很貴"
print "a unicode string:", x # shows in message area
# a unicode string: 評價很高耶!! 不過價錢真的很貴
switchApp("Safari") # I am on Mac
paste(x)

I have tested a similar situation on my Win 7-32 and Firefox: works the
same.

So current version of Sikuli IDE is fully unicode (utf8) aware.

This is done by telling Jython, that the coding in the processed script is utf8, by using the magic comment
# coding=utf8
Which is inserted internally in the first line of the script source, when running a script.

So as long, as you make sure, that your strings contain utf8-encoded
text, paste() (which internally is nothing else than filling the
clipboard using Java features and simulating a ctrl/cmd-v) should work,
as long as the target GUI element is utf8-aware.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.