sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #28635
Re: [Question #255559]: sikuli-IED:"print u'2byte character' " is wrong.
Question #255559 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/255559
Status: Open => Answered
RaiMan proposed the following answer:
I have to confirm this problem, but only on Windows (tested with version
1.1.0 which contains Jython 2.7b2 and with Java 7 and 8).
- the usage of the codecs module leads to the mentioned weird behavior.
Seems to be some Jython problem when using the same interpreter instance again (as is the case in Sikuli IDE when rerunning a script in the same IDE session).
--- running the below test script on Windows:
- the popups show the expected output
- on commandline, in the unicode situation ? are printed for each unicode character using the Java println
- the simple Python print refuses to work with unicode characters with a decoding error
this is the test script I used:
import codecs
import java.lang.System as JS
#sys.stdin = codecs.getreader('utf-8')(sys.stdin)
#sys.stdout = codecs.getwriter('utf-8')(sys.stdout)
text = "字"
textu = unicd(text) # a wrapper for unicode(text, "utf-8")
# instead one can use: text = u"字"
JS.out.println("plainJ: " + text)
JS.out.println("unicodeJ: " + textu)
popup("plain: " + text)
popup("unicode: " + textu)
print "plain:", text
print "unicode:"
print unicode(text,"utf-8")
--- getting this output on Mac
plainJ: å
unicodeJ: 字
plain: å
unicode:
字
with the popups showing the expected output.
--- conclusion:
seems to be a Jython problem on Windows.
I do not have any idea currently how to solve this.
I take it as a bug.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.