Special characters

Smpp v3.4 client

Moderator: alt

Locked
mrudula
Posts: 20
Joined: Thu Jul 08, 2010 9:20 am

Special characters

Post by mrudula » Tue Feb 15, 2011 9:36 am

Hello Alt!

When we send special characters in messages, they do not come properly. Ex: ? appears as some other alphabets. Please help me to solve this problem

Thanks!
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: Special characters

Post by alt » Tue Feb 15, 2011 10:14 am

Where "?" appears? On mobile phone or in application?
What data_coding do you use?
mrudula
Posts: 20
Joined: Thu Jul 08, 2010 9:20 am

Re: Special characters

Post by mrudula » Tue Feb 15, 2011 12:01 pm

Hello!

If i send a message "How r u ?" , i do not receive question mark on mobile. Instead it gives A and pound sign.
I am using default encodong.
Rest of the special characters come properly after using the GSMEncode function. The problem is only with ?
Please help

The GSMEncode function is as follows taken from one of the posts:

public static byte[] GSMEncode(string PlainText)
{
// ` is not a conversion, just a untranslatable letter.
// x0D should be CR but this causes double linefeed on
// some phones so has been removed.
const string strGSMTable =
"@?$???????\n??`??" +
"Δ_ΦΓΛΩΠΨΣΘΞ`????" +
" !\"#¤%&'()*+,-./" +
"0123456789:;<=>?" +
"?ABCDEFGHIJKLMNO" +
"PQRSTUVWXYZ????§" +
"?abcdefghijklmno" +
"pqrstuvwxyz?????";

const string strExtendedTable =
"````````````````" +
"````^```````````" +
"````````{}`````\\" +
"````````````[~]`" +
"|```````````````" +
"````````````````" +
"`````?``````````" +
"````````````````";

using (System.IO.MemoryStream ms = new System.IO.MemoryStream())
{
foreach (char cPlainText in PlainText.ToCharArray())
{
if (cPlainText != '`') // Ignore `
{
int intGSMTable = strGSMTable.IndexOf(cPlainText);
if (intGSMTable != -1)
{
ms.WriteByte((byte)intGSMTable);
continue;
}
int intExtendedTable = strExtendedTable.IndexOf(cPlainText);
if (intExtendedTable != -1)
{
ms.WriteByte(27);
ms.WriteByte((byte)intExtendedTable);
}
}
}

ms.Close();
return ms.ToArray();
}
}

Please help!
Thanks in advance
Locked