Search code examples
pythonraspberry-pipyserialgsmat-command

How can I send umlauts to a smartphone with a GSM module?


I build a SMS-Server on a Raspberry Pi 4B connected to a GSM-Module with Python. This is the GSM-Module I use: Waveshare Wiki. I can send SMS to my customers infoming them about there order.

My Problem is that I can't send "Umlauts" like "ÄäÖöÜü" and specific characters like "ß". Whenever I try to send them to my own Phone they get replaced by other characters.
For example an "ä" gets replaced by "@¤".

Im using AT+CSCS="GSM" to set the Module to the GSM Character set and AT+CMGF=1 to send the SMS in clean text.
My main Question is: does anyone know what I can try to send the umlauts correctly?

The umlauts are all correctly transferred to the SMS server and the server then sends them to the GSM module using the pySerial library. serial.write(sms_text.encode('utf-8'))

I thought maybe the character set of the GSM module does not have the umlauts. Does each GSM module have its own character set or is there a standard for it?


Solution

  • According to SIM 800 AT command manual, at paragraph 3.2.12, the module supports the following character sets:

    "GSM" - GSM 7 bit default alphabet (3GPP TS 23.038);
    "UCS2" - 16-bit universal multiple-octet coded character set (ISO/IEC10646); UCS2 character strings are converted to hexadecimal numbers from 0000 to FFFF; e.g. "004100620063" equals three 16-bit characters with decimal values 65, 98 and 99
    "IRA" - International reference alphabet (ITU-T T.50)
    "HEX" - Character strings consist only of hexadecimal bers from 00 to FF;
    "PCCP" - PC character set Code
    "PCDN" - PC Danish/Norwegian character set "8859-1" ISO 8859 Latin 1 character set

    In your case, I would try at least two options:

    1. PCDN - Danish/Norwegian character set

      Send command

       AT+CSCS="PCDN"
      

      and write normally the characters into serial port. This character set supports the characters you need, as explained in this code chart.

    2. UCS2 - Unicode

      Send command

       AT+CSCS="UCS2"
      

      and, for each character you need to print, write to serial the corresponding 4 hexadecimal characters corresponding to its code, as you can find in the following code chart.
      For example, character Ö can be obtained by writing to +CMGS command the code 00D6.

    If the first solution works you are fine. The second solution has the drawback to require the encoding of each character to be sent, but makes you ready to support almost every character set in the world.