I've inherited some code part of which is to encrypt a string, and then it is saved to a file. See below.
The problem is that when the EURO € (and I presume some other characters) are included in string the are changed to a question mark ?
DES.Key = MD5.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(key))
DES.Mode = CipherMode.ECB
Dim DESEncrypt As ICryptoTransform = DES.CreateEncryptor()
Dim Buffer As Byte() = System.Text.ASCIIEncoding.ASCII.GetBytes(stringToEncrypt)
Return Convert.ToBase64String(DESEncrypt.TransformFinalBlock(Buffer, 0, Buffer.Length))
I'd appreciate help on this as to how to avoid problem. The fundamental of code can't really change as there are files already saved using this method
Thanks in advance