cdma中文短信编码,请有cdma经验的指点一二(高分求助,如能解决问题可再送分)

prog6791 2004-04-29 04:54:14
我是采用如下方法编码的,但对方收到的时部分是乱码
//将短信内容编码
private string GetMessage(string strValue)
{




string strTemp="";
int iLen=0;
Byte[] bt=new Byte [1024];
Byte btTemp=new Byte();
string strValue1=strValue;
System.Text .Encoding .Unicode .GetBytes (strValue1,0,strValue1.Length ,bt,0);
for(int i=0;i<bt.Length ;i=i+2)
{
if(bt[i]==0 && bt[i+1]==0)
{
iLen=i;
i=bt.Length ;

}
else
{
btTemp=bt[i];
bt[i]=bt[i+1];
bt[i+1]=btTemp;
}
}

strTemp=System.Text .Encoding .ASCII .GetString (bt,0,iLen);


return strTemp;

}
...全文
302 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
prog6791 2004-04-29
  • 打赏
  • 举报
回复
好,谢谢!!!!!!!!!!!!!!!!!!
runnercn 2004-04-29
  • 打赏
  • 举报
回复
private string GetMessage(string strValue)
{




string strTemp="";
int iLen=0;
Byte[] bt=new Byte [1024];
Byte btTemp=new Byte();
string strValue1=strValue;
System.Text .Encoding .Unicode .GetBytes (strValue1,0,strValue1.Length ,bt,0);
for(int i=0;i<bt.Length ;i=i+2)
{
if(bt[i]==0 && bt[i+1]==0)
{
iLen=i;
i=bt.Length ;

}
else
{
btTemp=bt[i];
bt[i]=bt[i+1];
bt[i+1]=btTemp;
}
}

strTemp=System.Text .Encoding .Default.GetString (bt,0,iLen);


return strTemp;

}

110,533

社区成员

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

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

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