How to send special characters using .sendInputEvent

I want to send special characters as an input from the main process.

The following method works with some special characters, for example “↔” but not with all of them.

contents.sendInputEvent({type:'keyDown', keyCode:↔});
contents.sendInputEvent({type:'char', keyCode: ↔)});
contents.sendInputEvent({type:'keyUp', keyCode:↔});

For example it doesnt work with an emoji or “𝑥”.