C#短信解码
移动的短信回执,收到的编码是“0031003065E500310031003A00320033002081F30031003500300033003100310039003900370030003477ED4FE190018FBE000A536B751F90E856DE5E94690D726959766CB95B89516895EE9898FF0C79F06B638FDB884C98CE96698BC44F30FF1B6B64524D670962A5905379F051765BCC542B53CD5F0F810280AA9178FF0C589E52A060A375C598CE9669”
和普通短信编码有很大区别,希望有人能解出来并提供方法,谢谢了
------解决方案--------------------这个是PDU串
string _mobileNumber = “12345678901”;//手机号码
string _content =”测试”;//短信同容
string centerNo = “13800100500”;
string length = string.Empty;
string smstosendPDU = string.Empty;
length = PDUencoding.CountSMSLength(_mobileNumber, _content);
smstosendPDU = PDUencoding.PDUEncodingSMS(centerNo, _mobileNumber, _content);
string str = "AT+CMGS=" + length + "\r" + smstosendPDU + "\x01A";//指令格式
tbSmsPduCode.Text = str;
1 /// <summary>
2 /// 计算消息长度
3 /// </summary>
4 /// <param name="_phoneNumber">Phone</param>
5 /// <param name="_targetText">Context</param>
6 /// <returns></returns>
7 public static string CountSMSLength(string _phoneNumber, string _targetText)
8 {
9 if (!(_phoneNumber.Substring(0, 2) == "86"))
10 {
11 _phoneNumber = String.Format("86{0}", _phoneNumber); //检查手机号是否按标准格式书写,不是,就补上“”
12 }
13 return (8 + ((_phoneNumber.Length % 2) == 0 ? _phoneNumber.Length / 2 : (_phoneNumber.Length + 1) / 2) + _targetText.Length * 2).ToString();
14 }
15
16 /// <summary>
17 /// 对整个要发送的短信的PDU编码
18 /// </summary>
19 /// <param name="cscaNumber"></param>
20 /// <param name="PhoneNumber"></param>
21 /// <param name="TargetText"></param&