编码和解码错误 [英] error with encoding and decoding

查看:103
本文介绍了编码和解码错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我已经使用了编码和解码.
我的代码中的编码成功运行,但是当我们重定向解码时,发生了一个错误.
错误是:-"Base-64字符串中的无效字符"

 公共 静态 字符串 Base64DecodingMethod(字符串 sData)
   {

       字节 [] encData = System.Convert.FromBase64String(sData);
       字符串 result = System.Text.ASCIIEncoding.ASCII.GetString(encData);
       返回结果;

   }

解决方案

我将尝试两件事...按顺序

1.查看您要解码的字符串,看看是否有明显的痕迹
2.

public static string Base64DecodingMethod(string sData)
   {

       byte[] encData = System.Convert.FromBase64String(sData);
       string result = System.Text.ASCIIEncoding.ASCII.GetString(encData);
       return result;

   }

解决方案

I''d try two things ... in order

1. Look at the string you''re trying to decode, and see if anything obvious sticks out
2.
Google the error message[^] and start at the first response, it seems quite exhaustive


这篇关于编码和解码错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆