当前位置:   article > 正文

C#将字符转换成utf8编码 GB321编码转换_c# 字符串转utf8

c# 字符串转utf8
原文地址为: C#将字符转换成utf8编码 GB321编码转换

public static    string  get_uft8(string unicodeString)
{
UTF8Encoding utf8 = new UTF8Encoding();
Byte[] encodedBytes = utf8.GetBytes(unicodeString);
String decodedString = utf8.GetString(encodedBytes);
return decodedString;
}

 

   这边我以big5转换gb2312为例
Encoding big5 =Encoding.GetEncoding("big5");
Encoding gb2312 = Encoding.GetEncoding("gb2312");


byte[] big5b= big5.GetBytes("編程無悔!");
//关键也就是这句了
byte[] gb2312b= Encoding.Convert(big5,gb2312,big5b);

string strGb2312 = gb2312.GetString(gb2312b)

 


转载请注明本文地址: C#将字符转换成utf8编码 GB321编码转换
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/253400
推荐阅读
相关标签
  

闽ICP备14008679号