[request] non US keyboard layouts should be supported --- workaround: use paste() instead

Bug #1492020 reported by bo-leo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SikuliX
Fix Released
Medium
RaiMan

Bug Description

--- problem ---------------
From beginning Sikuli's type() only supports the characters, that can be produced by a US-querty-keyboard. This is a restriction based on the internally used Java features.

--- workaround ------------
use paste() instead, eventually type() before and/or after to issue functional keys like Key.ENTER

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

I'm using a french computer (supposed to be charset iso-8859-1/azerty keyboard) ....
I was trying to automate login process and password and was always fail.
I made, a very simple test case :
 - select a text field : click(whatever img)
 - write some characters : type("1234567890")

Text field now contains "&é"'(-è_çà"

Looks like this is the upper case combinaison with "1234567890"

For some reason, it's a very strange behaviour, as letters are correctly typed : "azerty1234" results in "azerty&é"' and not "AZERTY&é"' so i guess it's only affecting numerical characters. Bug also happens with paste() method instead of write()...

I didn't figure out any option for changing the charset in ui. Launching IDE from jvm commandline with JAVA_TOOL_OPTIONS="-Dfile.encoding=iso-8859-1" didn't fix anything.

Details :
Sikuli 1.1.0-20150901.230935-153 + windows 10 pro (x64) french + jdk 1.8.0_60-b27 (x64)
Sikuli 1.0.1 also contains this bug

bo-leo (boleofr)
description: updated
description: updated
description: updated
description: updated
description: updated
RaiMan (raimund-hocke)
summary: - Error with non english charset
+ [request] non US keyboard layouts should be supported
Changed in sikuli:
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → RaiMan (raimund-hocke)
milestone: none → 2.0.0
summary: - [request] non US keyboard layouts should be supported
+ [request] non US keyboard layouts should be supported --- workaround:
+ use paste()
description: updated
Revision history for this message
RaiMan (raimund-hocke) wrote : Re: [request] non US keyboard layouts should be supported --- workaround: use paste()

--- Bug also happens with paste()
should not be at least with version 1.1.0.

please post an example, that does not work in your opinion.

Revision history for this message
bo-leo (boleofr) wrote :

As stated, bug happens in both type() and paste() methods, so can't be a workaround

Found a valid workaround :
-> parse string and remplace all numerical characters with corrresponding Key.NUMx
It does work but it's not the most efficient

Will post screenshot later when back at home, with 4 tests

- Type("1234567890"+Key.ENTER)
- Paste("1234567890"+Key.ENTER)
- Type(Key.NUM1+Key.NUM2+Key.NUM3+Key.NUM4+Key.NUM5+Key.NUM6+Key.NUM7+Key.NUM8+Key.NUM9+Key.NUM0+Key.ENTER)
- Paste(Key.NUM1+Key.NUM2+Key.NUM3+Key.NUM4+Key.NUM5+Key.NUM6+Key.NUM7+Key.NUM8+Key.NUM9+Key.NUM0+Key.ENTER)

Revision history for this message
RaiMan (raimund-hocke) wrote :

paste() does not interpret the Key.xxx values (these are just non-printable unicode-characters for internal use with type() and write()).

paste() uses "ctrl+V" to simulate a paste action after having put the stuff to the clipboard.

so the correct use in your case is:
paste("1234567890")
type(Key.ENTER)

Revision history for this message
bo-leo (boleofr) wrote :

If only the 3 first tests will be revelant, I alreadyd one these :
- type("1234567890") gives "&é"'(-è_çà"
- paste("1234567890") gives "&é"'(-è_çà"
- Type(Key.NUM1+Key.NUM2+Key.NUM3+Key.NUM4+Key.NUM5+Key.NUM6+Key.NUM7+Key.NUM8+Key.NUM9+Key.NUM0+Key.ENTER) gives "1234567890"

Revision history for this message
RaiMan (raimund-hocke) wrote :

I just activated French language on my Win10-64.

I tested with the latests SikuliX 1.1.0 IDE.

using
click() # activates an opened notepad window
wait(1)
paste("1234567890")
type(Key.ENTER)

simply does what it should:
the notepad window after that contains 1234567890 and a linefeed.

So I cannot reproduce your problem with paste()

Revision history for this message
bo-leo (boleofr) wrote :

Ok, i guess i was a bit enthousiatic !

I ran a fresh installl (windows+java+sikulix, nothing else) and paste() is working fine !

Revision history for this message
RaiMan (raimund-hocke) wrote :

ok, fine (thanks for the push, to setup a Windows 10, will now be my daily development system ;-)

RaiMan (raimund-hocke)
summary: [request] non US keyboard layouts should be supported --- workaround:
- use paste()
+ use paste() instead
description: updated
RaiMan (raimund-hocke)
Changed in sikuli:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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