Go Down

Topic: Sending "umlaut" via SMS (Read 386 times) previous topic - next topic

TommiP

Feb 26, 2017, 03:17 pm Last Edit: Feb 27, 2017, 10:14 am by TommiP
Hi all

I'm making device which sends me an sms message if certain circumstances will occur in my home. I'm using Uno, SIM900 GSM/GPRS shield and on top of those shield I've manufactured by myself.. ..but that's not the point of this issue I'm asking.

I've used English so far but now I've tried something else. Here in Scandinavia we use kind of weird letters, compared to US or any other English spoken/written state. There aren't any english expression for those but let's call them Scandinavic letters. Here is Finland we use three of those, å ä ö or Å Ä Ö depending situation. I've managed to print those as ascii charachter to the serial monitor and also to the lcd (i2c) but how those could be sent via sms message ? I've sent text via sms but if there is this kind of letter or ascii character, it will send everything before this character but nothing after it.

Here's code I've tried with single character:
Code: [Select]

#include <SoftwareSerial.h>

boolean sendingMessage = false;
boolean numberOK = false;

String receiverNumber = "358xxxxxxxxx";

SoftwareSerial SIM900(7, 8);

void setup()
{
     if(receiverNumber != "000000000000")
     {
         Serial.print("Number OK! ");
         numberOK = true;
         Serial.println(receiverNumber);
     }
     else
     {
         Serial.println("\nNumber missing...");
         numberOK = false;
     }
 
     Serial.begin(115200);
     SIM900.begin(19200);
 
     // set SMS mode to text
     SIM900.print("AT+CMGF=1\r");
     delay(100);
 
     // blurt out contents of new SMS upon receipt to the GSM shield's serial out
     SIM900.print("AT+CNMI=2,2,0,0,0\r");
     delay(100);
 
     char sa = (char)228;
 
     SendTextMessage(receiverNumber, sa);
}

void loop()
{
     // do nothing here
 
}

void SendTextMessage(String receiver, char message)
{
     if (numberOK == true)
     {
         sendingMessage = true;
         Serial.println("Sending SMS..");
         Serial.print(message);
         Serial.println();
 
         SIM900.print("AT+CMGF=1\r");    // SMS in text mode
         delay(100);
         SIM900.println("AT + CMGS = \"+"+ receiver +"\"");
         delay(100);
         SIM900.println(message); // the content of the message
         delay(100);
         SIM900.println((char)26); // ctrl+z
         delay(100);
         SIM900.println();
         delay(1000);
         SIM900.println("AT+CMGD=1,4"); // delete all SMS
         sendingMessage = false;
     }
     else
     {
         Serial.println("\nCannot send SMS, number missing!..\n");
     }
}


..and here is code I've tried with Strings (I know, you guys doesn't like those)  :)
Code: [Select]

#include <SoftwareSerial.h>

boolean sendingMessage = false;
boolean numberOK = false;

String receiverNumber = "358xxxxxxxxx";

SoftwareSerial SIM900(7, 8);

void setup()
{
     if(receiverNumber != "000000000000")
     {
         Serial.print("Number OK! ");
         numberOK = true;
         Serial.println(receiverNumber);
     }
     else
     {
         Serial.println("\nNumber missing...");
         numberOK = false;
     }
 
     Serial.begin(115200);
     SIM900.begin(19200);
 
     // set SMS mode to text
     SIM900.print("AT+CMGF=1\r");
     delay(100);
 
     // blurt out contents of new SMS upon receipt to the GSM shield's serial out
     SIM900.print("AT+CNMI=2,2,0,0,0\r");
     delay(100);
 
     SendTextMessage(receiverNumber, "testMessage");
     //SendTextMessage(receiverNumber, "testMesÄage");
}

void loop()
{
     // do nothing here
 
}

void SendTextMessage(String receiver, String message)
{
     if (numberOK == true)
     {
         sendingMessage = true;
         Serial.println("Sending SMS..");
         Serial.print(message);
         Serial.println();
 
         SIM900.print("AT+CMGF=1\r");    // SMS in text mode
         delay(100);
         SIM900.println("AT + CMGS = \"+"+ receiver +"\"");
         delay(100);
         SIM900.println(message); // the content of the message
         delay(100);
         SIM900.println((char)26); // ctrl+z
         delay(100);
         SIM900.println();
         delay(1000);
         SIM900.println("AT+CMGD=1,4"); // delete all SMS
         sendingMessage = false;
     }
     else
     {
         Serial.println("\nCannot send SMS, number missing!..\n");
     }
}


There is an attachment picture how result of the codes looks in the phone. Third row was result of the first code and there was no difference between characters, result for all weird ones was that "Ü". I tried few of those (0x225 - 0x228).

First two rows were depended about this part:
Code: [Select]

 SendTextMessage(receiverNumber, "testMessage");
 //SendTextMessage(receiverNumber, "testMesÄage");


I'd be appreciated if someone could kick me to the right path  :)

TommiP

dasaweb

Hi.

I have exactly the same problem. Did you find any solution back then?

Daniel

lesept

#2
Sep 22, 2018, 02:12 pm Last Edit: Sep 22, 2018, 02:14 pm by lesept
Maybe you can use the ASCII code for umlaut letters, and declare them as chars.
  • 132 for ä, 142 for capital
  • 134 for a with the ring, 143 for capital
  • 148 for ö, 153 for capital
A force d'essayer on finit par réussir... Donc, plus ça rate, plus on a de chances que ça marche (proverbe Sharduinok).

Go Up