-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Non-ascii characters not working on certain applications #88
Comments
Do you have posted a comment recently? I got a notification but cannot see any new comment here? I have looked into this a little bit and i can reproduce this. It seems like Firefox does need some more time than other applications to recognize Non-ascii characters. Here is the modified example that is running on my System (Archlinux) (the use enigo::{
Enigo,
MouseControllable,
KeyboardControllable,
};
use std::thread;
use std::time::Duration;
fn main() {
let mut enigo = Enigo::new();
// Make the following line aim the cursor at a text input field
enigo.mouse_move_relative(0, 0);
thread::sleep(Duration::from_secs(1));
enigo.mouse_click(enigo::MouseButton::Left);
thread::sleep(Duration::from_secs(1));
enigo.set_delay(400000);
enigo.key_sequence("hello world ❤️");
} |
Yeah I posted a comment and deleted it because it was wrong. It didn't occur to me that github sends an email for comments and it would seem weird. Sorry about the confusion. I added the delay as you suggest in my programme. And while this does make the problem better, it doesn't make it go away. What I mean is that, at least on my machine, with the delay it works some of the time, while some other times it still misses some non-ascii character. I had to try a few times to observe this. |
No worries. I think this is just an unfortunate trait of Xorg that we have to live with :/ ... we tried many implementations to get this working reliably but couldn't really figure it out and just used |
Regarding the "hack", with the key mapping. There is some documentation about it in Chapter 5. Keyboards on the following page: https://web.archive.org/web/20231005143214/https://x.org/releases/X11R7.7/doc/xproto/x11protocol.html However it contradicts the actual behavior :-) |
Describe the bug
Trying to simulate typing the string "hello world ❤️" in a text input field of firefox types only "hello world ". Similar results with other non-ascii characters, for example "¯\_(ツ)_/¯" results in "\_()_/". I also tested this keepassxc and it also fails.
In other applications like chromium / alacritty / telegram-desktop the string is printed correctly.
To Reproduce
Expected behavior
"hello world ❤️" should be printed in the text input field.
"hello world " is printed instead.
Environment (please complete the following information):
rustc 1.43.0-nightly (d3c79346a 2020-02-29)
and alsorustc 1.41.1 (f3e1a954d 2020-02-24)
Additional context
Might have something to do with #36 ?
Firefox version 73.0
From keepassxc
KeePassXC - Version 2.5.3
Revision: f8c962b
Qt 5.14.1
The text was updated successfully, but these errors were encountered: