mardi 31 mars 2015

Cannot convert from UTF8 to ASCII

I used some online encoding detection so all of them are saying that


2015%2d03%2d31


is encoded by UTF8.


So I used this code to decode it and to see


2015-03-31


But it doesn't work.



private static string UTF8toASCII(string text)
{
System.Text.Encoding utf8 = System.Text.Encoding.UTF8;
Byte[] encodedBytes = utf8.GetBytes(text);
Byte[] convertedBytes =
Encoding.Convert(Encoding.UTF8, Encoding.ASCII, encodedBytes);
System.Text.Encoding ascii = System.Text.Encoding.ASCII;

return ascii.GetString(convertedBytes);
}


Any clue?


Aucun commentaire:

Enregistrer un commentaire