Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Understanding codepages and encoding
Message
From
24/10/2006 14:17:04
Keith Payne
Technical Marketing Solutions
Florida, United States
 
 
To
24/10/2006 13:40:51
Bill Oeftering
Mainstreet Computers, Inc.
Belleville, Michigan, United States
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Miscellaneous
Thread ID:
01164137
Message ID:
01164152
Views:
8
>Newbee to .NET
>I have a simple encrption function that modifies the ascii values in a string. The result contains ascii values from 32 - 255. I'm having a problem with some bytes over 127. I think my string is being converted to unicode. Specificaly values of 131 are converted to 63. How do I create a function that returns a string without converting it ? Thanks, code is below:
> public String gaEncrypt(string tcText,string tcPass)
> {
> string lctext="";
> int lntext=0;
> int lnchar = 0;
> int lnpass = 0;
> for (lntext = 0; lntext < tcText.Length;lntext++)
> {
> lnchar = (int)tcText[lntext] + (int)tcPass[lnpass];
> if ((lnchar > 0) && (lnchar < 256))
> lctext=lctext+(char)lnchar;
> lnpass++;
> if (lnpass > tcPass.Length-1)
> lnpass = 0;
> }
>
> return lctext;
> }

Bill,

The string type in .NET is unicode. The only way to avoid it is to use byte arrays.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform