In my pr for imgui, I suggest defined ImWchar to ImWchar32(int32_t) for full 
unicode planes support. It’s for compatibility when users only need one plane 
(BMP) , and imgui use a 16bit array for internal buffers ( just trash the code 
points over BMP.

If we need handle surrogate pair for WM_CHAR (for example, emoji input from 
IME), we must combine two messages into one code point, and then convert into 
UTF-8. 

A half surrogate can not convert into UTF-8 correctly. It’s a common mistake 
for UTF-16 handling.

btw, There is a WTF-8 encoding for this : 
https://simonsapin.github.io/wtf-8/

发自我的 iPhone

> 在 2019年5月14日,20:45,Antonio Scuri <antonio.sc...@gmail.com> 写道:
> 
>   Hi,
> 
>   Interesting. I saw that you did this:
> 
>  if (sizeof(ImWchar) == 2)
>                 cp = 0xFFFD;
> 
>   We use the TCHAR definition which is a 16 bits value when UNICODE is 
> defined (the default in IUP), i.e. sizeof==2 by default. So we don't actually 
> need the "Surrogate" variable storage but just to replace the surrogate pair 
> by 0xFFFD. Is that correct?
> 
> Best,
> Scuri
> 
> 
>> Em qui, 9 de mai de 2019 às 04:45, 云风 Cloud Wu <clou...@gmail.com> escreveu:
>> IupGLText can't handle surrogate pairs (
>> https://en.wikipedia.org/wiki/UTF-16 ) now.
>> 
>> In windows, a unicode above U+10000 (For example U+1F604 😀 ) will be
>> separated into two WM_CHAR messages. If we got a WM_CHAR with WPARAM
>> between 0xD800 to 0xDBFF , we should wait for another part of
>> surrogate pair, and combine them into one unicode code point.
>> 
>> btw, I fix the same issue for imgui . This patch   (
>> https://github.com/ocornut/imgui/pull/2541/commits/fc2dff0ab602e77628a97edd983f03f6f571487a
>> ) is for your reference.
>> 
>> -- 
>> http://blog.codingnow.com
>> 
>> 
>> _______________________________________________
>> Iup-users mailing list
>> Iup-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/iup-users
> _______________________________________________
> Iup-users mailing list
> Iup-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/iup-users
_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to