-2

我正在使用 AT 命令为 GSM 调制解调器开发应用程序。我在阅读 Unicode 消息或 ussd 示例时遇到问题:dcs=17 not 7 or 15 or 72

两年前,我正在寻找解决方案无济于事我能够通过使用中文手机找到部分解决方案,手机可以读取中文编码但是所有诺基亚手机都不支持编解码器阿拉伯语或中文并且服务响应似乎难以理解符号示例:

+CUSD: 0,"ar??c 
?J <10???@d@??? @0@??@D? ?Z?xb 
@   $@?@?@Z@@?? @-@H?@???@b@@$? @3@h?P???@??(??",17

但是当你使用手机时显示中文响应服务100%正确我如何通过诺基亚手机或其他地址编码

4

1 回答 1

1

AT 命令中用于字符串的字符集由AT+CSCS. 默认值是"GSM"不能显示相对有限的字符集之外的任何内容。

在您的情况下,阅读阿拉伯语或中文"UTF-8"可能是最好的选择,尽管"UCS-2"也可以使用(虽然需要一些后期处理)。

您可以在下面看到所选字符集如何影响字符串。我一直把我在台湾时的中文老师的电话号码保存为中文的“老师”(lǎo shī)。此处删除了实际的电话号码,但除此之外,以下是我手机回复的逐字副本:

$ echo at+cscs? | atinout - /dev/ttyACM0 -

+CSCS: "GSM"

OK
$ echo at+cpbr=403 | atinout - /dev/ttyACM0 -

+CPBR: 403,"",145,"??/M"

OK
$ echo at+cscs=? | atinout - /dev/ttyACM0 -

+CSCS: ("GSM","IRA","8859-1","UTF-8","UCS2")

OK
$ echo 'at+cscs="UTF-8"' | atinout - /dev/ttyACM0 -

OK
$ echo at+cscs? | atinout - /dev/ttyACM0 -

+CSCS: "UTF-8"

OK
$ echo at+cpbr=403 | atinout - /dev/ttyACM0 -

+CPBR: 403,"",145,"老師/M"

OK
$ echo 'at+cscs="UCS2"; +cpbr=403' | atinout - /dev/ttyACM0 -

+CPBR: 403,"",145,"80015E2B002F004D"

OK
$ echo 'at+cscs=?' | atinout - /dev/ttyACM0 -

+CSCS: ("00470053004D","004900520041","0038003800350039002D0031","005500540046002D0038","0055004300530032")

OK
$ echo 'at+cscs="005500540046002D0038"' | atinout - /dev/ttyACM0 -

OK
$ echo 'at+cscs=?' | atinout - /dev/ttyACM0 -

+CSCS: ("GSM","IRA","8859-1","UTF-8","UCS2")

OK

更新,检查27.007后,+CUSD: <m>[,<str>,<dcs>]未经请求的结果代码的字符串不是常规字符串,而是有自己的编码:

<str>: string type USSD-string (when <str> parameter is not given,
       network is not interrogated):
  - if <dcs> indicates that 3GPP TS 23.038 [25] 7 bit default alphabet is used:
      - if TE character set other than "HEX" (refer command Select TE Character
        Set +CSCS): MT/TA converts GSM alphabet into current TE character set
        according to rules of 3GPP TS 27.005 [24] Annex A 
      - if TE character set is "HEX": MT/TA converts each 7-bit character of GSM
        alphabet into two IRA character long hexadecimal number (e.g. character
        Π (GSM 23) is presented as 17 (IRA 49 and 55))

  - if <dcs> indicates that 8-bit data coding scheme is used: MT/TA converts each
    8-bit octet into two IRA character long hexadecimal number (e.g. octet with
    integer value 42 is presented to TE as two characters 2A (IRA 50 and 65))

<dcs>: 3GPP TS 23.038 [25] Cell Broadcast Data Coding Scheme in integer format
(default 0)

因此,您必须首先确定 dcs 是 7 位还是 8 位,然后根据上述进行解码。


PS,这里描述的是“USC2 0x81”格式。尽管在这种特殊情况下,它的行为不应与普通 UCS2 不同。

于 2013-05-03T15:33:11.673 回答