Jython scripting: unicode strings: paste(utf-8 text) does not work --- workaround

Bug #1370420 reported by RaiMan
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SikuliX
Fix Released
High
RaiMan

Bug Description

***** workaround
general aspects: see comment #1

use instead until fixed:
paste(ucode("тест"))

which is convenience shortcut for
paste(ucode("тест", "utf8"))

--------------------------------------------------------

Trying to paste any cyrillic string in LinuxMint 17 XFCE inside Firefox results in something like that:
paste('тест') => тест

Tried regional settings RU/ENG, Firefox RU/ENG. Tried solution from here:
t='somestring'
paste(t).encode("UTF-8")) # hand it over with utf-8 encoding
(https://answers.launchpad.net/sikuli/+question/169226)

did not work for me either...

What else can be done?

RaiMan (raimund-hocke)
Changed in sikuli:
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → RaiMan (raimund-hocke)
milestone: none → 1.2.0
Revision history for this message
RaiMan (raimund-hocke) wrote :

I will write a HowTo into the docs about unicode handling in Sikuli scripts using Python language.

A general rule for version 1.1.0+:
Despite the fact, that strings containing unicode characters are shown correctly in the IDE, the usage at runtime (string functions, image filenames, Sikuli features accepting strings as parameters (e.g. paste()), ...) might make problems.
To avoid these possible problems, one should always use this notation for strings containing unicode characters:
aUnicodeString = u"cyrillic: тест"

now this string will be handled correctly at runtime all over the place.

any string (e.g. text loaded from a file) can be marked as being a unicode string by using:
aUnicodeString = ucode(otherString)

which is a convenience shortcut for
aUnicodeString = unicode(otherString, "utf8")

Some aspects (image filenames in Pattern(...) buttons) must be fixed.

description: updated
summary: - [1.1.0] Jython scripting: paste(utf-8 text) does not work --- workaround
+ [1.1.0] Jython scripting: unicode strings: paste(utf-8 text) does not
+ work --- workaround
description: updated
Changed in sikuli:
importance: Medium → High
RaiMan (raimund-hocke)
Changed in sikuli:
status: In Progress → Fix Released
summary: - [1.1.0] Jython scripting: unicode strings: paste(utf-8 text) does not
- work --- workaround
+ Jython scripting: unicode strings: paste(utf-8 text) does not work ---
+ workaround
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.