On Aug 11, 2012, at 3:39 PM, Huy Phan wrote:

> Every time I send keyboard events with unicode strings contain 2-byte unicode 
> characters, …

>    CGEventKeyboardSetUnicodeString(keyEventDown, 1, unicodeString);
>    CGEventKeyboardSetUnicodeString(keyEventUp, 1, unicodeString);

> Pages doesn't hang if unicodeString contains only 1-byte unicode character.

Above you mention 2-byte unicode characters and here you mention 1-byte unicode 
characters.  What precisely do you mean?  A "UniChar" is inherently 2-bytes.  
So the first mention (2-byte) seems redundant and the second is just wrong.

Also, note that there are some Unicode characters which can't be represented by 
a single UniChar.  Apple's UniChar and unichar types, the basis of CFString and 
NSString, are actually UTF-16 "code units", not really Unicode characters or 
"code points".  These terms have precise definitions in the Unicode standard, 
with which Apple's terminology does not conform.  Anyway, some Unicode 
characters will require two UTF-16 code units (a.k.a. UniChar values) to 
represent completely.  These are surrogate pairs.  Is there any chance you're 
putting an incomplete Unicode character, an unpaired surrogate, in your event?

Regards,
Ken


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to