Using Mac OS X 10.11.5.
I verified how the code creates an Applescript and spanws the execution of osascript with it. From what I checked, I got different results depending on the Input Source enabled on my OS.
This is a test script I created:
tell application "System Events"
keystroke "录"
keystroke "脦"
keystroke "漏"
keystroke "~"
keystroke "{"
keystroke "*"
keystroke "!"
keystroke "+"
keystroke "垄"
keystroke "f"
keystroke "4"
end tell
This is the result I got by running it having three different Input Sources selected:
a脦漏~{*!+垄f4aa漏~{*!+垄f4录a漏~{*!+垄f4Expected: 录脦漏~{*!+垄f4. Actually none of them got it right. :- (
Plus, we have to consider that the Input Source affects how an accented character is typed. In U.S. we would type 脦 as Alt+i, I. In Spanish - ISO or Brazilian - ABNT2 we would type it as ^, I. Maybe if we avoid using keystroke...
Also, when Spanish - ISO or Brazilian - ABNT2 are enabled, a password like ^A~A麓A gets auto-typed as 脗脙脕 (and U.S. actually gave me ^A~A脕). You can use http://keepass.info/help/kb/testform.html to check. I'd consider using copy-paste for non-alphanumeric characters as a solution.
windows: ^ disappears, other characters are working
linux: some characters are either skipped, or typed incorrectly
So:
^ and other modifiers must be escapedStatus Update
xdotool key U${code} instead of type ${text} and seems to work with different layouts脕 is typed as 芒 but this seems to be a bug of xdotool because it cannot type capital character by its name: xdotool key Aacute prints 谩. This may be fixed in future, now we'll stick to xdotool on linuxTested this on string !@#$%^&*()_+-={}[]:";'<>?,./泄褍褏^A~A麓A脗脙脕a脦漏~*!+垄f4 in English, Spanish - ISO, Brazilian - ABNT2 and Cyrillic layouts.
Current status