Character $ problems sending sms

Hi guys.

I have a problem with the $ character. Im using the an arduino shield to send sms and it works pretty well. The problem is tat whe I see the sms in the serial (Seria.println) its ok but in my cell phone there is no dollar icon... Here you have the result in my phone and part of the code so you can understand the question and the problem better.

Thank you all for your continuous support!

This is what I see in my phone: ¤Pruebas,01325,INI,18/09/2013,10:17:12*00

Serial.println("SENDING");
  Serial.println();
  Serial.println("Message:");
    txtMsg[nmi]='

;      nmi++;   for(ii=0; serialnumber[ii]!='\0'; ii++){    txtMsg[nmi]=serialnumber[ii];      nmi++;}    txtMsg[nmi]=',';      nmi++;    txtMsg[nmi]=attempt2[0]; // user      nmi++;    txtMsg[nmi]=attempt2[1];      nmi++;    txtMsg[nmi]=attempt2[2];      nmi++;    txtMsg[nmi]=attempt2[3];      nmi++;    txtMsg[nmi]=attempt2[4];      nmi++;    txtMsg[nmi]=',';      nmi++;    txtMsg[nmi]='I';      nmi++;    txtMsg[nmi]='N';      nmi++;    txtMsg[nmi]='I';      nmi++;    txtMsg[nmi]=',';      nmi++;  nmz=((dayOfMonth/10)+48);  nmy=((dayOfMonth%10)+48);      txtMsg[nmi]=nmz;      nmi++;    txtMsg[nmi]=nmy;      nmi++;              txtMsg[nmi]='/';      nmi++;    nmz=((month/10)+48);  nmy=((month%10)+48);      txtMsg[nmi]=nmz;      nmi++;    txtMsg[nmi]=nmy;      nmi++;              txtMsg[nmi]='/';      nmi++;            txtMsg[nmi]='2';      nmi++;      txtMsg[nmi]='0';      nmi++;          nmz=((year/10)+48);  nmy=((year%10)+48);      txtMsg[nmi]=nmz;      nmi++;    txtMsg[nmi]=nmy;      nmi++;     txtMsg[nmi]='*';      nmi++;   txtMsg[nmi]='0';      nmi++;   txtMsg[nmi]='0';      nmi++;        Serial.println(txtMsg);  // send the message  sms.beginSMS(phone_number);  sms.print(txtMsg);  sms.endSMS();  Serial.println("\nCOMPLETE!\n");  memset(txtMsg, 0, sizeof txtMsg);  nmi=0; ```

I couldn’t find your ‘¤’ character in the ASCII table (including the extended ASCII set).
Which phone are you using? Have you tried sending an SMS through another phone with a $ character in it and see if it shows? If it doesnt, then the problem is not related to Arduino but your phone itself.

BTW, off topic, but… you can do

    txtMsg[nmi]=',';
      nmi++;

with simply

    txtMsg[nmi++]=',';

In this nmi++ automatically increments nmi AFTER using its current value in that expression. Saves you one line in editing window. No difference in execution efficiency. Also some people hate it used this way. I don’t. :slight_smile:
Also, lookup strcpy() if you can. Will shorten your code by another order of magnitude.

Hi tttt,

I also send the sms to a web server and it also didn't recognize the dollar character... '¤' is not on the ascii table so I dont know what to do. Thanks for your idea! I have a very long and heavy code and I guess it could be much more shorter with tricks like that!

Thanks for your answer!

I also try adding: sms.print(’$’);

  // send the message
  sms.beginSMS(remoteNumber);
  sms.print('

But i just get the same character (‘¤’) two times…); 
  sms.print(txtMsg);
  sms.endSMS();
  Serial.println("\nCOMPLETE!\n");


But i just get the same character ('¤') two times...

I think your answer lies somewhere in the SMS protocol character set. Looks like it is not the usual ASCII set but a different set per GSM protocol (SMS wasd originally part of only GSM I think.) http://en.wikipedia.org/wiki/GSM_03.38

I also found your special character. http://en.wikipedia.org/wiki/%C2%A4 Says that it is a sign for "Unknown currency"!

In any case, I feel that it is not specific to Arduino software, so if you don't find your answer in these links then a better bet is to post it in some GSM/SMS/Mobile telephony boards.

I think that this happens because the Arduino sketch isn’t converting character encoding between UTF-8 used in the sketch and GSM 03.38 used within the SMS. The ascii code for ‘$’ would be 0x24 which corresponds to ‘¤’ in GSM 03.38. UTF-8 and GSM 03.38 are both derived from ascii and most of the characters happen to match, but some don’t.

If this is the only special character you need to deal with, you could probably get away with replacing with \2 in your string literals (2 is the GSM 03.38 code point for '').

Hi Peter, thanks for your answer.

I tried to write \2 instead of $ but I just get an @ in answer…

 txtMsg[nmi]='\2';

I find this table on the net and I’m “playing” with it but without results by now.

http://www.csoft.co.uk/sms/character_sets/gsm.htm

Try writing straight 2. ie. txtMsg[nmi]=2; If compiler gives an error (i doubt) then cast it. ie. txtMsg[nmi]=(char) 2;

dgelectron: I tried to write \2 instead of $ but I just get an @ in answer...

That's odd - it seems that the encoding that we've been looking at is not the one your carrier is using. Maybe you could do some trial and error - just send bytes 0, 1, 2, etc in a message and see what characters you receive at the other end. Once you've found what value corresponds to the character you want, you can use that one in your code.

Hi Peter.

I’ve try what you say, attached you will find a picture of my computer monitor with the result. As you will see the first 31 characters are the same. The $ is ok in the picture but not in my phone. I also attached picture of my phone screen… :~

Hi tttt,

I just read now your post. I dont hear before about the GSM code…bu it still not works…don´t know what to do.

Thanks for your time guys!

You didn't tell us if SMS sent from another phone shows the $ character on your phone? What's the model of your phone? And who is the carrier?

Unfortunately the character codes you want to send are not printable ascii codes so when you print them to the serial port the Arduino serial monitor doesn't know how to display them and just displays a little square symbol. Because of this I can see what the phone displays, but I can't see what character codes that corresponds to. Can you show what character codes you actually sent in the message? (I'm guessing it was all the codes from 0 upwards, but I'd like to make sure.)

Hi tttt, the phone is a Blackberry (Orange) but I also try with a Samnsung Galaxy S3 (Movistar) with the same result.

Hi PeterH, I attached the table of GSM codes, I think those are the characters.

ASCII&GSM.xls (29.5 KB)