How to tell the differences between ASCI and Unicode string?

dragon4spy

Centurion
Joined
Dec 22, 2003
Messages
110
Hi there! :) Since ASCI character is 8 bits long, and Unicode chracter is 16 bits long.

Is there any special bit in a string that make it unicode or asci? :D

How to display unicode string in vb.net program?

How to convert unicode string to asci and vice-visa?
 
ASCII is actually only 7 bits long, ANSI is 8 bits. Under .Net all strings are treated as unicode anyway so nothing special is needed to display them.

As for converting between them have a look under the System.Text namespace - lots of stuff under there
 
This is not quite as easy as it sounds. I've been looking all night via the net for how to get a vulgar fraction to display, whether on the console or in a messagebox or written to an xml file (which is ultimately what I'm trying to do.) I find that no matter what I try I get the square symbol that the system prints when it doesn't know how to generate the character. I am looking for info for system.text but I haven't seen anything that will allow me to preserve the character I want to display.
 
It might help if you showed what code you have so far - displaying 1/4 (U+00BC) works fine in a messagebox and to the console here (are you using a font that does support this character?) without any problems.

As far as writing out to any type of text file (xml or otherwise) then make sure you are using an encoding that is Unicode. Also for xml files ensure the declaration agrees with the encoding type used as differences between them can cause problems.
 
Back
Top