Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why does not my program convert UTF8 chars? 1

Status
Not open for further replies.

mrdance

Programmer
Apr 17, 2001
308
SE
I have read an xmlfile with utf8-encoding into an arraylist of strings. The problem is that when displaying the characters in a form the utf8 is not converted but in it's raw format. I am using Tahoma as font.

How can I solve this?

--- neteject.com - Internet Solutions ---
 
Tahoma is not a Unicode-enabled font. Try Arial Unicode MS (comes with Office).

Also, you are using an instance of the UTF8Encoding class when reading the file, right?

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Changing to a unicode did not solve the trick. But I made this solution (converting the utf8 string to the current codepage):

Dim encodedBytes As Byte() = System.Text.Encoding.Convert(utf8encoding, encoding, encoding.GetBytes(strWord))
Dim bb As Byte
Dim newstring As String

For Each bb In encodedBytes
newstring = newstring & (ChrW(bb))
Next

I can't get it right with japanese characters but maybe I have to be japanese to get it right! :) Or maybe another font?

--- neteject.com - Internet Solutions ---
 
Thanks, but if I have to have a special font for japanese, then I have to create custom messageboxes, right? Or are messageboxes in an own font?

--- neteject.com - Internet Solutions ---
 
Yes, you won't be able to use the system MessageBox class, as it doesn't provide a way to set the font.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top