如何将UTF-8的编码变成gb2312的编码

rainhard 2003-09-12 01:29:46
如何将UTF-8的编码变成gb2312的编码
...全文
57 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
速马 2003-09-12
  • 打赏
  • 举报
回复
楼上的都已经说了...
不过UTF-8好啊...为什么要转成GB2312呢
project 2003-09-12
  • 打赏
  • 举报
回复
用Encoding
wkyjob 2003-09-12
  • 打赏
  • 举报
回复
byte[] byteData = System.Text.Encoding.UTF8.GetBytes(strSend);
popcorn 2003-09-12
  • 打赏
  • 举报
回复
System.Text.Encoding.GetEncoding("GB2312").....
wsuyu_allcom 2003-09-12
  • 打赏
  • 举报
回复
public static string UCSUnCode(string szPdu)
{
string tempStr="";
for(int i=0;i<szPdu.Length-1;i=i+4)
{
string m=szPdu.Substring(i,4);
int n=int.Parse(m,System.Globalization.NumberStyles.AllowHexSpecifier);
tempStr=tempStr+Convert.ToChar(n);
}
return tempStr;
}
备注:
这是我在写手机短信息解码PDU时写的函数!里面可以把UNICODE字符转为汉字(中文)
killer_wzb 2003-09-12
  • 打赏
  • 举报
回复

byte[] byteTemp = System.Text.Encoding.Default.GetBytes(s);
CodingPCPiG 2003-09-12
  • 打赏
  • 举报
回复
string command = ChatOut.Text;
Byte[] outbytes = System.Text.Encoding.GetEncoding("GB2312").GetBytes(command.ToCharArray());

不知道是不是这个意思???
雪狼1234567 2003-09-12
  • 打赏
  • 举报
回复
byte[] strings = UnicodeEncoding.Unicode.GetBytes(strValue);
m_strings=Convert.ToBase64String(strings);
rouser 2003-09-12
  • 打赏
  • 举报
回复
給你一篇php的代碼
你嚐試著翻譯一下吧
http://www.phpx.com/show.php?d=col&i=58
clxxj 2003-09-12
  • 打赏
  • 举报
回复
编辑web.config
<globalization
requestEncoding="gb2312"
responseEncoding="gb2312"
/>

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧