Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Windows-1252
Message
General information
Forum:
ASP.NET
Category:
Other
Title:
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01153643
Message ID:
01153967
Views:
11
>I receive an array of bytes that is supposed to represent a string of characters. The characters are coded using Windows-1252 character encoding.
>I have two tasks:
>1) Convert the byte array to a string.
>2) Change the string and create a new byte array.
>
>
>Until now I have been using the following code:
>
>string myString = ASCIIEncoding.ASCII.GetString(byteArray);
>
>byte[] byteArray = ASCIIEncoding.ASCII.GetBytes(myString);
>
>
>Now all was well until someone sent be a byte that was greater than 0x7F.
>
>Does anyone know how I can convert a byte array to a string using the Windows-1252 character encoding and then convert back?
>
>Thanks,
>Einar

Well I ended up creating my own custom class with a static lookup table, mostly because because there were some chars that had to be excluded (like the ß which is one of my fav chars), but also because creating a lookup table was probably the easiest solution.
Semper ubi sub ubi.
Previous
Reply
Map
View

Click here to load this message in the networking platform