Jump to content
Xtreme .Net Talk

How to tell the differences between ASCI and Unicode string?


Recommended Posts

Posted

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?

Don't judge a man by his look. Don't judge a book by its cover. :D
  • Administrators
Posted

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

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

  • 3 years later...
Posted
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.
  • Administrators
Posted

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.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...