← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #156443]: how to use the paste function to input chinese

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
I confirm, that your approach does not solve the problem.

But since I know, that it works in the Sikuli IDE, I had a look at the
sources to find out, how they manage it.

You need 2 things:

--1. Python encoding directive (you did it already)
in the first or second line os your script you need a magic comment that defines the encoding used for the script:
# coding=utf-8

there are some other options, but for a Jython script this works.

--2. you have to tell the JVM, the same thing by giving this as a parameter when calling the JVM:
-Dfile.encoding=utf-8

When I did this with the Sikuli contained Jython 2.5.1 it worked, the
same way as it does in the Sikuli-IDE:

java -Dfile.encoding=utf-8 -cp absolute-path-to\sikuli-script.jar
org.python.util.jython utftest.py

The script successfully pastes a unicode character into a unicode aware inputfield, e.g.
paste("<é>")

So you have to find out, how to add this parameter to the Java/Jython
environment of Jython2.5.2 (I remember, that the comments in the
jython.bat give some hints about the recognized environment variables).

hope it helps.

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