Hi,
I'm having trouble with an SMS message I am sending using a provider called Cymba.
Basically I'm posting the message over to them as per their specifications URL encoded.
However when the message is sent to my phone the £ appears with an A in front i.e. £A
Now C# strings are Unicode by default, so I switched to ASCII encoding and the £ comes over as ?.
I've tried converting the message string to hex starting form the Unicode and ASCII versions (as via this gateway you an also submit the message as hex). However the same behaviour occurs.
I suspect it is something to do with the string encoding as SMS supports a 7bit encoding format: GSM 03.38
I suspect also that if I send over Unicode I'll only get a 70 or 140 char message instead of the standard 160.
I'm quite new to SMS sending so any help or advice will be appreciated.
So the question is, how can I get my C# strings into this format?
Update: Looks like the Gateway is the one with the problem not my code as I tried replacing the offending £ with the 7bit equivalent hex value and this did not work either. See below for my test code which may help others in future:
byte pound = 0xA3;
byte GSMPound = 0x01;
string hexxedMsg = "";
System.Text.UnicodeEncoding encoder = new System.Text.UnicodeEncoding();
byte[] msgBytes = encoder.GetBytes(message);
foreach (byte byt in msgBytes)
{
if(byt == pound)
hexxedMsg += GSMPound.ToString("X");
else
hexxedMsg += byt.ToString("X2"); ;
}