【发布时间】:2012-10-18 20:14:43
【问题描述】:
我运行这段代码时出现异常,有什么问题
var encoder = new System.Text.UTF8Encoding();
System.Text.Decoder utf8Decode = encoder.GetDecoder();
byte[] todecodeByte = Convert.FromBase64String(encodedMsg);
int charCount = utf8Decode.GetCharCount(todecodeByte, 0, todecodeByte.Length);
var decodedChar = new char[charCount];
utf8Decode.GetChars(todecodeByte, 0, todecodeByte.Length, decodedChar, 0);
var message = new String(decodedChar);
这一行出现异常
byte[] todecodeByte = Convert.FromBase64String(encodedMsg);
【问题讨论】:
-
需要更多信息。
encodedMsg的内容是什么?异常发生在哪里?等等…… -
编码后的消息是否包含数字?
标签: c# exception decode encode