Read sms unicode characters from gsm module.

Hi to all, am trying to read an sms from an A6 module that has Greek chars and can not display the greek characters.

If i read the sms as pdu and decode it online i read it all correct.

Is there any way to read those Greek chars directly from serial and if not does anyone has any pdu to text functions?

Tryed to find any library for pdu but with no success.

Here is my ino

Thank you

#include <LiquidCrystal.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(8,9);

const int rs = 2, en = 3, d4 = 4, d5 = 5, d6 = 6, d7 = 7;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

String ttl_in;
String ttl_out;

char* s2c(String strIn){ //String to Char[]
        char *p = const_cast<char*>(strIn.c_str());
        return p;

void gsmInit()
  lcd.print(" MINI G6 MODULE ");
  lcd.print("  INITIALIZING  ");

  digitalWrite(10, HIGH);
  digitalWrite(10, LOW);

  do {
  if (mySerial.available() > 0){ttl_in = mySerial.readString(); Serial.print(ttl_in);}
  } while (ttl_in.indexOf("Call Ready") < 0);

  lcd.print("  MODULE READY  ");    

void sendSms()
  mySerial.write(" MINI G6 MODULE ");

void setup() 
      lcd.begin(16, 2);

void loop() {
      if (Serial.available() > 0)
        ttl_in = Serial.readString();
        if(ttl_in.indexOf("rst") >= 0){gsmInit(); ttl_in = "";}
        if(ttl_in.indexOf("sms") >= 0){sendSms(); ttl_in = "";}
        if(ttl_in != ""){mySerial.write(s2c(ttl_in));}
      if (mySerial.available() > 0){ 
        ttl_out = mySerial.readString();
        if(ttl_out != ""){Serial.print(ttl_out);}

Can not display the Greek characters, where?

Can't print them to serial. Prints all other chars of sms except special ones like (Σ,Θ,Δ) etc.

What I would prefer is a pdu to text function in order to access sms fields if needed.

Thank you

As an update, I found out how to read a pdu sms but the only thing can't find is how to decompress 8bit octets to 7bit assets.

This is how the message content is compressed.

I know the method but am very new to arduino and can't find the methods to use.

Thank you

You do know that unicode are multi-byte characters...? A simple serial terminal of any sort doesn’t understand any MBCS (multi byte character set)

If you load an appropriate application on your PC, and send the complete character octet, you will be getting closer to unicode, but PDU messages include a region/char-set identifier in the header - you’ll need to let the receiving application know that as well, so it can load up the appropriate character table to match.

Yes I know that, what I don't know is how to convert the octets string to assets that is all. I know where the octets string begins and it's size inside the pdu.

All I got so far is that I must convert the hex to binary and move last digit from every next octet to every beginning of the previous octet, but that is for compressing.

Any examples for decompression would be very much appreciated as I am a visual learner.

Thank you all

Try trawling through this list from Google - I can see several links that will push you along the right track.

GOOGLE - sms character sets

(TBH - I found PDU & MBCS/Unicode too hard in SMS, so I found a modem that allows me to send multi-part messages in text mode!) Also - BTW, I don't believe SMS supports Unicode, but it uses foreign character tables - which you would have to 'translate' with a lookup based on the charset in use. It will NEVER come out the serial port as Unicode until/unless you re-encode the foreign pseudo-ASCII into 8-bit high characters available on your terminal character set..

Well, I did a lot of reading, I know how the conversion is done but can't find out how to do it in Arduino IDE.

Don't know, either can find the commands to substract and join the bits.

Anyway, seems that very few people worked on pdu decompression at arduino language.

Thank you

The Arduino is straight C with C++ on top. So any bit manipulation algorithm will drop straight in with virtually no changes. What you are looking for are the bitwise operators.