asp.net下UTF-7转GB2312编码的代码(中文)
更新时间:2010年07月22日 18:40:54 作者:
UTF-7转换GB2312编码的方法
复制代码 代码如下:
/// UTF-7转换GB2312编码的方法
/// </summary>
/// <param name="str7"></param>
/// <returns></returns>
public static string utf72Unicode(string str7)
{
string sUtf7 = "";
if (str7.StartsWith("&"))
{
sUtf7 = "+" + str7.Substring(1);
}
else
{
sUtf7 = str7;
}
byte[] bytes = System.Text.Encoding.GetEncoding("gb2312").GetBytes(sUtf7);
byte[] byteret = System.Text.Encoding.Convert(System.Text.Encoding.UTF7, System.Text.Encoding.Unicode, bytes);
string sret = System.Text.Encoding.Unicode.GetString(byteret);
return sret;
}
相关文章
NET Core 3.0 AutoFac内置DI替换的新姿势分享
这篇文章主要给大家介绍了关于NET Core 3.0 AutoFac内置DI替换的新姿势,文中通过示例代码介绍的非常详细,对大家学习或者使用NET Core 3.0具有一定的参考学习价值,需要的朋友们下面来一起学习学习吧2019-09-09
System.Data.SqlClient.SqlException: 无法打开登录所请求的数据库 登录失败。
今天帮客户配置服务器的时间,安全设置后,将sqlserver以普通用户权限运行的时候提示这个错误。2011-08-08
asp.net DropDownList 三级联动下拉菜单实现代码
asp.net DropDownList 三级联动下拉菜单效果代码,需要的朋友可以参考下。2009-12-12
将DataTable中的一行复制到另一个DataTable的方法
将DataTable中的一行复制到另一个DataTable的方法...2007-09-09
解决 .NET Core 中 GetHostAddressesAsync 引起的 EnyimMemcached 死锁问题
这篇文章主要介绍了解决 .NET Core 中 GetHostAddressesAsync 引起的 EnyimMemcached 死锁问题的相关资料,需要的朋友可以参考下2016-09-09


最新评论