Unicode encoded text display in C #

My application displays text characters in English, Japanese, and Chinese in the text box and LinkLabel. I am currently checking to see if there are Unicode characters and change the font to MS Mincho or leave it in Tahoma.

Now MS Mincho displays Japanese correctly, but for Chinese I have to use Sim Sun. How can I distinguish between the two?

How can I guarantee the correct display of text in Unicode regardless of font / language?

+4
source share
3 answers

If you have Unicode characters for each text, using a Unicode-enabled font should cover it properly (e.g. Arial Unicode MS).

+4
source

You cannot guarantee the correct display of text in Unicode, regardless of font and language, because there is no single font that can display all possible Unicode characters . You must select a font that can display the unicode characters you need to display.

+2
source

All lines in C # are Unicode. English (Latin), Japanese and Chinese code points are located only in different ranges of code points.

I think you have two options:

  • Find a Unicode font containing characters for all code points in all three languages.

  • Try to guess the language and select a font containing characters for code points in that language.

For option 2, you can look at Unicode charts to find out where the different code points are, and deploy your algorithm to guess the language.

Example for Hiragana :

bool IsHiragana(char ch) { return (ch >= '\u3040') && (ch <= '\u309f'); } bool IsHiragana(string s) { return s.Count(IsHiragana) > 0; } 
+2
source

All Articles