sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #28640
[Bug 1379722] Re: [1.1.0] Windows: print u'2byte character' (unicode, utf-8) does not work
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.
** Description changed:
- This is the sample code about which I worry.
+ ********* more information see comment #1
+
+ ------------------------------------------
+
+ This is the sample code about which I worry.
--------
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
reload(sys)
import codecs
sys.stdin = codecs.getreader('utf-8')(sys.stdin)
sys.stdout = codecs.getwriter('utf-8')(sys.stdout)
print unicode("漢字","utf-8")
--------
"漢字" is 2byte character.
- An error does not occur.
- However, it is not displayed normally.
+ An error does not occur.
+ However, it is not displayed normally.
- First, sikuli-IED is started.
+ First, sikuli-IED is started.
First execution :
- 漢字
- >>In the first execution, it is displayed normally.
+ 漢字
+ >>In the first execution, it is displayed normally.
Second execution :
- æ¼¢å
- >>In the second execution, a display is wrong.
+ æ¼¢å
+ >>In the second execution, a display is wrong.
Third execution :
- æ¼¢åÂÂ
- >>The third execution is wrong in a display further again.
+ æ¼¢åÂÂ
+ >>The third execution is wrong in a display further again.
Fourth execution :
- æüâÃÂ¥ÃÂÃÂ
+ æüâÃÂ¥ÃÂÃÂ
Fifth execution :
- ÃÂæÃÂüÃÂâÃÂÃÂ¥ÃÂÃÂÃÂÃÂ
+ ÃÂæÃÂüÃÂâÃÂÃÂ¥ÃÂÃÂÃÂÃÂ
Sixth execution :
- ÃÂÃÂÃÂæÃÂÃÂÃÂüÃÂÃÂÃÂâÃÂÃÂÃÂÃÂ¥ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ
+ ÃÂÃÂÃÂæÃÂÃÂÃÂüÃÂÃÂÃÂâÃÂÃÂÃÂÃÂ¥ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ
7th execution :
- ÃÂÃÂÃÂÃÂÃÂÃÂÃÂæÃÂÃÂÃÂÃÂÃÂÃÂÃÂüÃÂÃÂÃÂÃÂÃÂÃÂÃÂâÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ¥ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ
+ ÃÂÃÂÃÂÃÂÃÂÃÂÃÂæÃÂÃÂÃÂÃÂÃÂÃÂÃÂüÃÂÃÂÃÂÃÂÃÂÃÂÃÂâÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ¥ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ
- It becomes strange rapidly.
+ It becomes strange rapidly.
May I know how to resolve this issue? Thanks!
--
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1379722
Title:
[1.1.0] Windows: print u'2byte character' (unicode, utf-8) does not
work
Status in Sikuli:
In Progress
Bug description:
********* more information see comment #1
------------------------------------------
This is the sample code about which I worry.
--------
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
reload(sys)
import codecs
sys.stdin = codecs.getreader('utf-8')(sys.stdin)
sys.stdout = codecs.getwriter('utf-8')(sys.stdout)
print unicode("漢字","utf-8")
--------
"漢字" is 2byte character.
An error does not occur.
However, it is not displayed normally.
First, sikuli-IED is started.
First execution :
漢字
>>In the first execution, it is displayed normally.
Second execution :
æ¼¢å
>>In the second execution, a display is wrong.
Third execution :
æ¼¢åÂÂ
>>The third execution is wrong in a display further again.
Fourth execution :
æüâÃÂ¥ÃÂÃÂ
Fifth execution :
ÃÂæÃÂüÃÂâÃÂÃÂ¥ÃÂÃÂÃÂÃÂ
Sixth execution :
ÃÂÃÂÃÂæÃÂÃÂÃÂüÃÂÃÂÃÂâÃÂÃÂÃÂÃÂ¥ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ
7th execution :
ÃÂÃÂÃÂÃÂÃÂÃÂÃÂæÃÂÃÂÃÂÃÂÃÂÃÂÃÂüÃÂÃÂÃÂÃÂÃÂÃÂÃÂâÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ¥ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ
It becomes strange rapidly.
May I know how to resolve this issue? Thanks!
To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1379722/+subscriptions
References