Question Displaying unicode

dcs.79c

Member
Joined
Feb 21, 2011
Messages
6
Programming Experience
Beginner
What is the source code to display Unicode text in a textbox?

I basically know how to display ASCII code in a text box, but I'd like to be able to display Unicode in a text box.

Thank you.
David
 
Here are the results of this evening's experiments, part I/II

First on my main PC, with Windows XP Home

I now have three fonts that all cover U+A750 - U+A760

a) Andron Scriptor Web
b) Palemonas MUFI
c) Junicode

I opened each one in turn in BabelMap and scrolled down to U+A750, and I could see all the characters. I took screenshots.

I then opened each one in turn in MS Character Map

With Andron and trying to scroll down it jumps from U+2767 to U+E004
With Palemonas and trying to scroll down it jumps from U+2767 to U+E004
With Junicode and trying to scroll down it jumps from U+232A to U+E0D1

I took screenshots.

In all three fonts Character Map jumps over the area where the Latin symbols are located. I tried entering the Unicode directly in the Go to Unicode: box, but did not succeed with any of the three fonts.

I then tried a copy/paste from BabelMap into Wordpad, having set the font in both to the same, using character U+A752. Immediately I did the Ctrl-V Wordpad skipped a space, producing no visible character, and the Font then changed to SimSun!

I then repeated this exercise with a character that Character Map could see, and this pasted fine from each font. However, once the character had pasted, the font in Wordpad then changed from what I had set it to to Arial.

I then tried a copy/paste from BabelMap into Notepad, having set the font in both to the same, using character U+A752, and for each font the paste did work!


I then repeated all the above on my laptop, with Windows XP Professional, and got the same results.

Next I will try various experiments with RichTextBox, Label and TextBox in VB 2005, copy/pasting from Character Map and from BabelMap...
 
First with BabelMap:


Any character that can see in BabelMap, but CANNOT see in Character Map will not work following a copy/paste, for any of the 3 fonts. I just get the square box.

Any character that I can see in both BabelMap AND Character Map works, whether copy/pasting from either (and when I say copy/pasting I mean into the quotes in this code behind the Button1

RichTextBox1.Text = RichTextBox1.Text.Insert(RichTextBox1.SelectionStart, "a")

Similarly with the character code, if the character is in Character Map it will work. If it is in BabelMap but not in Character Map it will not:

RichTextBox1.Text = RichTextBox1.Text.Insert(RichTextBox1.SelectionStart, ChrW(&HA752))


Wowser, wowser!!

Everything works fine in a TextBox (rather than a RichTextBox). I can copy/paste a character from BabelMap (that Character Map cannot see) into the quotes, or use the code, eg ChrW(&HA752) and the button does what it says on the tin.

It also works in Labels!

I am now happy and content, I now have a solution.

I will now leave it to others to work out why a TextBox works in displaying any Unicode character contained in a font (regardless of whether Character map can see it), but a RichTextBox will not, (only if Character Map can see it), and why Character Map only shows a subset of character contained in a unicode font.
 
Back
Top