ANSI字符串转化成unicode字符串

joyhen joyhen 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
一个unicode字符串,转换成ANSI字符串以实现

public static string UnicodeToAscii(string paramstr)
{
if (paramstr.Length > 0)
{
byte[] array = System.Text.Encoding.ASCII.GetBytes(paramstr);
string str = null;
for (int i = 0; i < array.Length; i++)
{
int asciicode = (int)(array[i]);
str += Convert.ToString(asciicode);
}
return str;
}
else
{
throw new Exception("Unciode Code is not valid.");
}
}

如何再将上面的 str 转回来呢,
求详细代码,立马结贴
...全文
评论 3
收藏 已收藏
分享
返回顶部
joyhen
C# 111,128 成员 642,536 内容