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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting a Unicode string to ANSI

Status
Not open for further replies.

lorenzodv

Programmer
Feb 16, 2001
95
0
0
IT
As you know, VB.NET strings are Unicode by default (2-byte, 16-bit characters). I need to send messages to a remote server and it strictly requires me to send single-byte ANSI strings. Is there a way in .NET to automatically convert the strings to ANSI or do I need to strip the even bytes out myself?
Thanks.
 
I had already tried using the System.Text.Encoding.ASCII class. The problem with that is that it converts the script to 7-bit (aka Standard) ASCII, and not to 8-bit (aka Extended) ASCII. For instance, standard alphanumerical characters are converted, but characters such as "è" or "©" (decimal codes 232 and 169, both beyond 127) are converted into decimal 63, wich is "?".
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top