如何将umlauts发送到带有GSM模块的智能手机?

huangapple go评论79阅读模式
英文:

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

问题

我在树莓派4B上使用Python构建了一个与GSM模块连接的SMS服务器。我使用的是这个GSM模块:Waveshare Wiki。我可以向我的客户发送短信,通知他们有关他们的订单。

我的问题是,我无法发送像"Umlauts"(如"ÄäÖöÜü")和特定字符(如"ß")。无论我尝试将它们发送到我的手机,它们都会被其他字符替换。例如,"ä"会被替换为"@¤"

我使用AT+CSCS="GSM"来设置模块为GSM字符集,然后使用AT+CMGF=1来以纯文本形式发送短信。

我的主要问题是:有谁知道我可以尝试发送正确的umlauts吗?

umlauts都正确传输到SMS服务器,然后服务器使用pySerial库将它们发送到GSM模块。
serial.write(sms_text.encode('utf-8'))

我想也许GSM模块的字符集不包含umlauts。每个GSM模块是否有自己的字符集,还是有一个标准字符集?

英文:

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 &quot;&#196;&#228;&#214;&#246;&#220;&#252;&quot; and specific characters like &quot;&#223;&quot;. Whenever I try to send them to my own Phone they get replaced by other characters.<br>For example an &quot;&#228;&quot; gets replaced by &quot;@&#164;&quot;.

Im using AT+CSCS=&quot;GSM&quot; to set the Module to the GSM Character set and AT+CMGF=1 to send the SMS in clean text.<br>
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(&#39;utf-8&#39;))

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?

答案1

得分: 2

根据SIM 800 AT命令手册,在第3.2.12段中,该模块支持以下字符集:

  1. "GSM" - GSM 7位默认字母表(3GPP TS 23.038);
  2. "UCS2" - 16位通用多八位编码字符集(ISO/IEC10646);UCS2字符串将转换为十六进制数字,从0000到FFFF;例如,"004100620063"等于三个具有十进制值65、98和99的16位字符;
  3. "IRA" - 国际参考字母表(ITU-T T.50);
  4. "HEX" - 字符串仅由十六进制数字00到FF组成;
  5. "PCCP" - PC字符集代码;
  6. "PCDN" - PC丹麦/挪威字符集 "8859-1" ISO 8859拉丁1字符集

在您的情况下,我建议至少尝试以下两种选项:

  1. PCDN - 丹麦/挪威字符集

    发送以下命令:

    AT+CSCS="PCDN"
    

    然后将字符正常写入串行端口。此字符集支持您需要的字符,如在此代码表中所解释的那样。

  2. UCS2 - Unicode

    发送以下命令:

    AT+CSCS="UCS2"
    

    然后,对于每个您需要打印的字符,将相应的4位十六进制字符写入串行端口,您可以在以下代码表中找到每个字符的代码。例如,字符 &#214; 可以通过写入 +CMGS 命令的代码 00D6 来获得。

如果第一种解决方案有效,那就很好。第二种解决方案的缺点是需要对要发送的每个字符进行编码,但它使您准备好支持世界上几乎每种字符集。

英文:

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);<br>
"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<br>
"IRA" - International reference alphabet (ITU-T T.50)<br>
"HEX" - Character strings consist only of hexadecimal bers from 00 to FF;<br>
"PCCP" - PC character set Code<br>
"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<br>

    Send command

     AT+CSCS=&quot;PCDN&quot;
    

    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=&quot;UCS2&quot;
    

    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.<br>
    For example, character &#214; 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.

huangapple
  • 本文由 发表于 2023年3月9日 21:29:29
  • 转载请务必保留本文链接:https://go.coder-hub.com/75685274.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定