Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Windows-1252
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Windows-1252
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01153643
Message ID:
01153643
Vues:
50
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
Semper ubi sub ubi.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform