Skip to content
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

Long Unicode escape sequences do not work #356

Closed
SpecialCharacter opened this issue Feb 13, 2021 · 6 comments
Closed

Long Unicode escape sequences do not work #356

SpecialCharacter opened this issue Feb 13, 2021 · 6 comments

Comments

@SpecialCharacter
Copy link

I encoded superscript Glagolitic A as kbc.type('\u1E000'), but it gave me Ḁ=.
When I tried the proper character, it said Type Error.

@SpecialCharacter
Copy link
Author

PS: Tried it with '\U0001E000' and '\N{COMBINING GLAGOLITIC LETTER AZU}'.
Always Type Error.

@SpecialCharacter
Copy link
Author

PPS: Updated to latest pynput version. Error persists.

@SpecialCharacter
Copy link
Author

Ḁ is u1E00 (i.e. a zero missing). I do not why he puts = (003D).

@SpecialCharacter
Copy link
Author

Sorry, it's Ḁ0, not Ḁ=. So he prints u1E00, 0 instead of u1E000.
But when I try the long version U0001E000, it said Type Error. That should not happen, right?

@moses-palmer
Copy link
Owner

I tested this with the following command: python -c 'import pynput, time; time.sleep(4); pynput.keyboard.Controller().type("\U0001E000")'.

On my system, Linux/XWayland, this prints the expected character. On Windows, unicode is limited to 16 bits in many cases. pynput uses the KEYBDINPUT struct to describe events, and the field designated for the unicode representation of the character is limited to 16 bits since the field wScan is of type WORD.

So, in short, what you are trying to do is not possible using the current implementation in pynput.

@SpecialCharacter
Copy link
Author

OK, so at least I am not crazy...
Is there a temporary fix? Using a different entry method than KEYBDINPUT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants