How to add Unicode support to CRichEditCtrl?

My application used the MFC CEdit control and we had no problems with wide character strings (Unicode). After switching to CRichEditCtrl, it seems that Unicode is no longer supported. Chinese characters become "??" etc. I read that CRichEditCtrl uses RichEdit * under the hood, and I played with a mouseover attempt, but nothing works.

I thought it could be a font, but I can, of course, write Unicode to the control using the ALT key method, only when they are saved in the model and written back, they are "????".

Is there a hidden property somewhere, some kind of manual configuration that I have to do when initializing a dialog that will include Unicode?

+3
source share
1 answer

I found out that MFC automatically uses RichEdit 1.0. If you are not using the RichEdit 2.0, 3.0, or 4.0 implementation, you will not have genuine Unicode support through advanced editing. I managed to manually change the properties in the resource file: change the class name from "RICHEDIT" to "RichEdit20W" for RichEdit 2.0 (with Unicode support).

Voila! Unicode support!

+5
source

Source: https://habr.com/ru/post/1718503/


All Articles