如何通过GSM调制解调器发送包含波斯文本的短信?

时间:2018-05-18 07:47:00

标签: c# character-encoding gsm persian pdu

我将在C#中使用gsm调制解调器发送波斯短信,我有一个问题,当我发送消息时,短信不正确,例如textmessage ='سلام',我收到了'????'。 modem model = dlink 157 请更改我的代码

SerialPort sp = new SerialPort();
sp.PortName = "COM13";
sp.Open();

sp.Write("AT\r");
Thread.Sleep(2000);

sp.Write("AT+CSCS=HEX\r\n");
Thread.Sleep(2000);

sp.Write("AT+CMGF=1\r\n");
Thread.Sleep(2000);

sp.Write("AT+CSMP=1,173,0,8\r\n");
Thread.Sleep(2000);

sp.Write("AT+CMGS=" + "09120000000" + Char.ConvertFromUtf32(13));
Thread.Sleep(2000);           

sp.Write("سلام" + "\x1A" + "\r\n");
Thread.Sleep(2000);

var response = sp.ReadExisting();
if (response.Contains("ERROR"))
{
    MessageBox.Show("ERROR");
}
else
{
    MessageBox.Show("SEND");
}
sp.Close();

0 个答案:

没有答案