Nearly, I used RichEditCtrl in a MFC project, and I want to take formatted RTF text in that control to display on a HTML control. I searched through CodeGuru and found this one. It’s a nice job, but it leaks 2 things:
- Doesn’t work well with unicode. In fact, it can’t recognize unicode characters.
- A minor error when calculating font size.
As you maybe known, in RTF format, an unicode character is encoded in two ways:
- \u6884: 6884 is character code (in decimal) of this letter (it’s “Ấ“) .
- \’1EA4: 1EA4 is character code (in hexadecimal) of this letter (it’s “Ấ“) .
So I slightly modified Daniel Beutler’s code in order to work around these problems. You can found my code in the following functions: CRTF_HTMLConverter::R2H_CreateHTMLElements and Util::StringToLong.
Posted by phvu