Search code examples
c#unicodesmsgsmat-command

how to reading Unicode Messages (such as in Persian and Arabic) in C# using AT Commands through GSM Modem?


i read this post to send Unicode sms message but i want to know how to read utf8 messages?

Sending Unicode Messages (such as in Persian and Arabic) in C# using AT Commands through GSM Modem

i send this command but recieved message text is something like:

 AT+CMGL="ALL"

  +CMGL: 1,"REC READ","97563937625","","2013/08/28 00:53:30+18"
     0041006A006D0064006A00740020

my commands to read sms:

          ExecCommand(port,"AT", 300, "No phone connected");

            ExecCommand(port,"AT+CSCS=\"UCS2\"\n", 300, "No phone connected");

            ExecCommand(port,"AT+CMGF=1", 300, "Failed to set message format.");

            ExecCommand(port,"AT+CPMS=\"MT\"", 300, "Failed to select message storage.");          

            string input = ExecCommand(port, "AT+CMGL=\"ALL\"", 5000, "Failed to read the messages.");

Solution

  • I don't think UTF8 is supported by GSM. From http://en.wikipedia.org/wiki/Short_Message_Service

    Short messages can be encoded using a variety of alphabets: the default GSM 7-bit alphabet, the 8-bit data alphabet, and the 16-bit UCS-2 alphabet

    and from http://en.wikipedia.org/wiki/GSM_03.40

    The messages in Chinese, Korean or Japanese languages must be encoded using the UTF-16 character encoding

    The Data Coding Scheme (TP-DCS) field contains primarily information about message encoding. GSM recognizes only 2 encodings for text messages and 1 encoding for binary messages:

    GSM 7 bit default alphabet (which includes using of National language shift tables as well)

    UCS-2

    8 bit data

    In the same paragraph they tell that there is a new national-based encoding (the National language shift table) that was introduced in 2012. Still this isn't UTF-8.