Support Unicode Characters for .typeString()#276
Conversation
- rudimentary UTF-8 parsing - tested with Chinese characters - doesn't work with emojis yet - tested on mac but not other platforms
- Try windows-friendly 32 unsigned integer type called unsigned long
|
After some amount of trial and error, it seems |
|
Update: After decoding, characters are re-encoded into UTF-16 to be used with CGEventKeyboardSetUnicodeString. This fixes all sending codepoints higher than 0x10000. That means emojis now work :) |
|
This is amazing, thank you so much for looking into this. I'll check it out soon! |
|
Yay, I think this is the smallest set of changes to get unicode working but I'm pretty sure there's a better way to structure this. Let me know if you've a way to make it better :) |
|
Is it possibile to create a new release for that, there is need in a project and i think more people want to have this support |
|
@octalmage would it be fine to merge this first? |
|
of course ... do you know when this will be done? |
|
@octalmage What about merging this PR? Seems a nice addition. |
|
I do not have a problem if you merge this pr with #326 |
|
This does not work in Windows |
|
Hello guys, how can i run this branch locally. I know its noob question but do i have only to pull it or this keypress.c must be compiled. And what is the git command to pull this specific branch. |
|
Which boils down to running the following from your shell from within a clone of the robotjs repository. git fetch origin pull/276/head:unicode
git checkout unicode |
|
Sorry everyone! I've been busy, but thanks again! I'll get a new release out this weekend. |
|
I don't know the best way to do this, but I grabbed HEAD and put it in a release so that I could use this library. https://www.npmjs.com/package/robotjs_head_2017-12-01 . And it works! Thank you zz85 for the fix. |
|
@alice0meta you can use a fork directly as npm dependency. https://docs.npmjs.com/cli/install |
|
@octalmage - any chance you will be releasing an official fix soon? |
|
@zz85 hi how can use your change that support utf in windows version |
Here's is preliminary patch for support unicode characters in robotjs for
.typeString().This fixes #16 #30
It has does simple UTF-8 parsing (without validation) and I have tested this with Chinese and accented characters [edit: and emjios] on MacOS.
However, I have not figured how to have emojis sending yet nor have I have tested it on other platforms although I've tried to make the code changes minimal here.