4

I am trying to send Unicode SMS using at commands and USC2 encoding. But it doesn't work, as I get errors. Here is my inputs:

AT
OK
AT+CSCS = ? 
+CSCS: ("IRA","GSM","UCS2")
AT+CSCS="UCS2"
OK
AT+CMGF=1
OK
AT+CSMP=1,167,0,8 //So this one doesnt work, let's try with 17,167,0,8
ERROR

AT+CSMP=17,167,0,8
OK
AT+CMGS="+370********"
ERROR

Or maybe I should use PDU mode to achieve this?

I have tried using older modem, and USC2 works in that one, however not in one im using. But im sure this conflicting modem supports USC2.

kaktusas2598
  • 641
  • 1
  • 7
  • 28
  • Fairly bizarre to see "*****" in a command that only should use digits. – Hans Passant Jul 25 '14 at 11:32
  • I just used '*' to keep privacy. – kaktusas2598 Jul 25 '14 at 11:37
  • Then it makes exceedingly little sense that AT+CSMP would work fine but not AT+CMGS. This is not an encoding problem. – Hans Passant Jul 25 '14 at 11:47
  • FYI for visitors from other threads marked as duplicate - please note the part of `AT+CSCS = ? /// +CSCS: ("IRA","GSM","UCS2") /// AT+CSCS="UCS2"` - this asks for encodings supported by the modem, and then selects UCS2 encoding, and then (...) – quetzalcoatl May 18 '18 at 07:54
  • more FYI: watch out for \r vs \r\n vs modem settings https://stackoverflow.com/questions/15312059/sending-unicode-messages-such-as-in-persian-and-arabic-in-c-sharp-using-at-com – quetzalcoatl May 18 '18 at 08:01

1 Answers1

8

I found I just needed to encode my number in AT+CMGS to UCS2, and now it works:

AT+CMGS="002B003300370030************************"
kaktusas2598
  • 641
  • 1
  • 7
  • 28
  • 1
    Yes, this is correct. After running `AT+CSCS="UCS2"`, every single string must be encoded that way (until another character encoding is chosen), so for instance to switch from UCS2 to UTF-8 would be AT+CSCS="005500540046002D0038". – hlovdal Jul 29 '14 at 16:51
  • 1
    Worth highlighting that this magic "002B003300370030.." is just a string, encoded to Unicode16-BigEndian, dumped byte-for-byte as HEX ~ "002B / 0033 / 0037 / 0030..." and it's actually equal to "+370" from the question. (and I know that it's eq to saying 'encode to UCS2', but really, I know many novices who would need it expanded..) – quetzalcoatl May 18 '18 at 08:04
  • More information at https://stackoverflow.com/a/25155746/638977 – Behzad Ebrahimi Dec 24 '19 at 06:56