Salut
comment connaitre l encodage d une string ; je recupere une string de cette forme :
Merci d avanceVoici le relev�
Salut
comment connaitre l encodage d une string ; je recupere une string de cette forme :
Merci d avanceVoici le relev�
Il n'y a pas vraiment de moyen de le savoir, sans avoir plus d'info.
Il y a des librairies qui permettent, en général, d'avoir l'encoding, mais ce n'est pas sûr à 100% (En gros, il essayent tous les encodage, et regardent si ça ressemble à quelque chose dans tel ou tel langage)
http://code.google.com/p/ude/
http://www.architectshack.com/TextFi...gDetector.ashx
Merci je vais essaye !
Ce que j ai deja essaye c est de convertir la string en essayant tous les Encoding disponible
En utilisant ce code :
Pourtant aucune convertion ne me retourne ce qu il faut !
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 class Example { static void Main() { string unicodeString = "This string contains the unicode character Pi (\u03a0)"; // Create two different encodings. Encoding ascii = Encoding.ASCII; Encoding unicode = Encoding.Unicode; // Convert the string into a byte array. byte[] unicodeBytes = unicode.GetBytes(unicodeString); // Perform the conversion from one encoding to the other. byte[] asciiBytes = Encoding.Convert(unicode, ascii, unicodeBytes); // Convert the new byte[] into a char[] and then into a string. char[] asciiChars = new char[ascii.GetCharCount(asciiBytes, 0, asciiBytes.Length)]; ascii.GetChars(asciiBytes, 0, asciiBytes.Length, asciiChars, 0); string asciiString = new string(asciiChars); // Display the strings created before and after the conversion. Console.WriteLine("Original string: {0}", unicodeString); Console.WriteLine("Ascii converted string: {0}", asciiString); } }
![]()
Partager