0
海兰,解码串XML
我想解码包含在.NET XML数据的字符串,但该字符串是在Java编码
System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding();
System.Text.Decoder utf8Decode = encoder.GetDecoder();
byte[] todecode_byte = Convert.FromBase64String(data);
int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length);
char[] decoded_char = new char[charCount];
utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0);
result = new String(decoded_char);
return result;
我写了代码,但它抛出错误。 在此先感谢。
什么是错误? –
对于所有二元的爱,请提供错误。 – ChaosPandion
输入不是有效的Base-64字符串,因为它包含非基本64字符,两个以上填充字符或填充字符中的非空白字符。 – jats