Quote Originally Posted by Krool View Post
Quote Originally Posted by Elroy View Post
Hey Krool ... on your RichTextBox, you made the .Text property accept full Unicode. I'm wondering why you didn't do the same to the .TextRTF property?

I do sometimes use something like WordPad to generate an RTF string, and then use it in my code. I just discovered that you can't use Unicode while setting this .TextRTF property.
I don't know what you mean. The SF_RTF is ANSI always, also in WordPad.
The SF_UNICODE flag cannot be combined with SF_RTF.
Ahhh, you are correct. I didn't think it through that far. I just took a small RTF string and used ChrW to put some Unicode characters in it, and it didn't work. And, I now realize, per RTF specifications, it shouldn't have worked.

To see this, I just fired up WordPad and put some Unicode characters into a document and then saved it. All I typed in was 111[alt-1234]222 and then saved it:

Name:  RtfUni.png
Views: 9201
Size:  763 Bytes

Here's the resulting RTF string:

{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fnil\fcharset0 Calibri;}{\f1\fnil\fcharset204 Calibri;}}
{\*\generator Riched20 10.0.19041}\viewkind4\uc1
\pard\sa200\sl276\slmult1\f0\fs22 111\f1\lang1049\u1234?\f0\lang1033 222\par
}

I bolded and made red the Unicode character. I now see that we must use the \u escape to get unicode characters into our RTF string.

So, it's all good.

Thanks,
Elroy