moses-palmer / pynput

Sends virtual input commands
GNU Lesser General Public License v3.0
1.73k stars 243 forks source link

Unable to .press() some emojis / other characters on Windows #561

Closed thisthingrighthere closed 11 months ago

thisthingrighthere commented 11 months ago

Description I have noticed that it is not possible to use the .press() function for emojis and other characters with a unicode ord >= 0x10000 on windows.

Platform and pynput version Windows 11 Pynput 1.7.6

To Reproduce

import unicodedata
from pynput import keyboard

kb = keyboard.Controller()

for i in range(int("10000", 16)-10, int("10000", 16)+100):
    k = chr(i)
    try:
        kb.press(k)
    except Exception as e:
        try:
            print(k, hex(ord(k)), unicodedata.name(k), e)
        except ValueError:
            print(k, hex(ord(k)), e)
moses-palmer commented 11 months ago

Tack you for your report.

A proposed fix for this was merged in 12acf84dc0f721d91a957da65311497acb664933 into master. It's it possible for you to test from that branch?

thisthingrighthere commented 11 months ago

This seems to working fine now on the master branch.

Thanks

moses-palmer commented 11 months ago

Great! Then I'll close this issue.