I'm using java to communicate with a gsm modem (Siemens) using AT commands.
I set the encoding of modem to "UCS2".
When sending messages as soon as I send the phone number I get ERROR from the device:
AT+CSCS=UCS2
OK
AT+CSMP=17,167,0,8
OK
AT+CMGF=1
OK
AT+CMGS="0919xxxxxxx"
ERROR
HELP ME, PLEEEEEEASE! :(
Asked
Active
Viewed 3,963 times
3

YasharHND
- 123
- 1
- 3
- 13
-
what the AT+CSCS=? command replies? Also the phone number shouldn't have the country code with the '+' symbol? – André Jul 30 '13 at 13:57
-
+CSCS: ("GSM","UCS2") I tested both ways 91 style (+9xxx...) and 92 (09xx...). – YasharHND Jul 31 '13 at 14:08
-
1try with AT+CSCS="UCS2" instead of AT+CSCS=UCS2. I think it accept the command but is not a valid value without the quotes, so it gives error when you try to send with CMGS – André Jul 31 '13 at 14:56
-
Thanks for your help, I still get ERROR, but I had to switch to sending sms in PDU format and it's working... – YasharHND Jul 31 '13 at 15:08
-
Then add this as answer and mark as answered :) – André Jul 31 '13 at 16:35
-
But this is not the solution! The problem is probably with my GSM modem; because I've seen a lot of samples on the internet using "UCS2" (or "HEX") and text mode and they did not report any issues. (So switching to PDU mode do not solve this problem!) :) – YasharHND Jul 31 '13 at 18:00
-
It is very possible that your modem doesn't not support the CMGS with UCS2. – André Jul 31 '13 at 18:07
2 Answers
6
I think you are encoding the <da>
address argument to AT+CMGS
incorrectly.
You refer to 91 and 92 style, but are you actually referring to the '81'/'82' format as explained in the Coding of Alpha fields in the SIM for UCS2 blog post about encoding as specified in 3GPP TS 11.11?
After you run AT+CSCS="UCS2"
every single string must be encoded that way, so for instance to switch from UCS2 to UTF-8 would be AT+CSCS="005500540046002D0038"
.
Alpha fields with 80/81/82 encoding only applies to some cases, and not UCS2 encoded strings in general. In particular notice that the encoding of the string "UTF-8" in the above AT+CSCS
command has nothing to do with this. That also applies to the <da>
argument to AT+CMGS
.

hlovdal
- 26,565
- 10
- 94
- 165