On Windows, if you have a UTF-16 sequence containing surrogate and that you insert that sequence in a RichEdit control, the RichEdit control handles this well and for each surrogate pair, it will only show one character.
The difficulty I'm facing is that when I query the selection, I'm getting the position in the UTF-16 stream, and not the character position as the number of visible characters in the control. I have a slow solution to find out the actual position, but it requires retrieving the text up to the selection in UTF-16 and then count myself the number of actual characters.
Did I miss something? Is there anything more efficient than that?
Thanks,
Manu
PS: To query the selection I'm using the EM_EXGETSEL message to fill a CHARRANGE structure.