•  GB2312转化为UTF-8:
string LanChange(string str)  
    {  
        Encoding utf8;  
        Encoding gb2312;  
        utf8 = Encoding.GetEncoding("UTF-8");  
        gb2312 = Encoding.GetEncoding("GB2312");  
        byte[] gb = gb2312.GetBytes(str);  
        gb = Encoding.Convert(gb2312,utf8,gb);  
        return utf8.GetString(gb);  
    }  
  • UTF-8转化为GB2312
string ChangeLan(string text)  
    {  
        byte[] bs = Encoding.GetEncoding("UTF-8").GetBytes(text);  
        bs = Encoding.Convert(Encoding.GetEncoding("UTF-8"), Encoding.GetEncoding("GB2312"), bs);  
        return Encoding.GetEncoding("GB2312").GetString(bs);  
    }  

  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-12
  • 2021-06-02
  • 2022-12-23
  • 2021-09-14
  • 2022-12-23
猜你喜欢
  • 2021-07-01
  • 2022-12-23
  • 2021-06-24
  • 2021-10-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案