I have finally found out how to resolve this problem. As I said in in the “Additional Information” section of my question, sending line ends with line feeds caused this mismatching between SerialPort
in C# and AT commands in hyperterminal for sending Unicode messages. I have just replaced \r
with \n
line feeds. The modified code is as follow:
GSMPort.Write("AT\n");
Thread.Sleep(1000);
GSMPort.Write("AT+CSCS=\"UCS2\"\n");
Thread.Sleep(1000);
GSMPort.Write("AT+CMGF=1\n");
Thread.Sleep(1000);
GSMPort.Write("AT+CMGS=\"" + destinationNumber + "\"\n");
Thread.Sleep(1000);
GSMPort.Write("0633064406270645" + "\x1A");
Leave SerialPort.Encoding
and SerialPort.NewLine
properties unchanged. It is not necessary to change their default values, just set AT+CSCS="UCS2"
to send messages in Unicode format.