我正在尝试将一些字符串从base-64编码转换回来,但是我无法得到正确的结果。
string text = base64string.... //Here I have a base-64 string.
byte[] encodedByte = System.Text.ASCIIEncoding.ASCII.GetBytes(text);
string base64Encoded = Convert.ToBase64String(encodedByte);
if (text == base64Encoded) //If the new encoded string is equal to its original value
return base64Encoded;
我已经尝试了多种方法,但似乎没有得到正确的结果。我已经尝试过使用System.Text.Encoding.Unicode
和System.Text.Encoding.UTF8
可能出了什么问题?有没有适当的解决方案?
text
与base64encoded
不匹配,因为base64encoded
是text
的“乱码”内容,:D - code4lifetext
字符串和已编码的base64Encoded
字符串。显然它们不同;在调试器中查看它们。 - Dour High Arch