views:

57

answers:

2

Hi,

My question might be a little bit confusing, but I think it's still worth of paying some attention.

Basically I'm designing a program to display all printable Unicode characters in a RichTextBox.

I'm using VC# 2010 Express Edition.

However, the RichTextBox has a critical problem: some special characters cannot be displayed correctly.

For example, some Korean Characters (ᄀᄁᆪᄂᆬᆭᄃᄄᄅᆰᆱᆲᆳᆴᆵᄚᄆᄇᄈᄡᄉᄊᄋᄌᄍᄎᄏᄐᄑᄒ), can be displayed correctly in Microsoft Word. After I copy to the RichTextBox, the characters cannot be displayed correctly. However, when I copy back to Microsoft Word, it can be displayed correctly.

Therefore, it's a display problem (the characters themselves are correct). I guess it might be a font problem.

Some related property info: RichTextBox.Font.GdiChaSet RichTextBox.Font

How can I solve it? So that all printable Unicode characters can be displayed correctly (using different fonts for different CharSets are acceptable).

Actually, I need further assistance about removing all formatting when pasting rtbxFileContent.Paste(DataFormats.GetFormat(DataFormats.Text)); // DataFormats.UnicodeText

I still need to have all printable characters to be displayed correctly, but without any formatting (except font).

Thanks.

Hope I made myself understood.

A: 

I hate sounding like MS Office Clippy, but your questions seems a lot like this one.

Essentially, you're not mad, it is hard. You could try reading/writing the text manually, using UTF8Encoding and BinaryWriter/BinaryReader.

cofiem
Hi cofiem, thanks for your reply. but you might have misunderstood my question, or can you paste some code for me. Basically, as I stated that, the characters themselves are correct (copied back to MS Word, can still be displayed correctly), so it might be the font issue for different char sets. I want the RichTextBox to be smart enough to display the special characters from different char sets with appropriate font(s) as MS Word did.
Peter Lee
A: 

I found the font "Arial Unicode MS" can almost solve my problem, but some characters from Char Sets looks weird to me. (Also, what if the user computer has not installed the font "Arial Unicode MS"?

So I'm still looking for a better universal solution to my question: automatically using different font for different Char Sets in the RichTextBox.

Thanks.

Peter Lee