Sending arabic SMS

I have a requirement where i need to send SMS using the API URL the issue i am facing is with Arabic language SMS as English is working fine and without any issue. I think i need to do some encoding or unicode conversion. Have any one used the arabic sms i would need the help in this regards.

Thank you in advance.

You would have to tell us more about about your solution before we can find problems in it.
“API URL” has no meaning.

Hi Martin,

Please review my job code as follows:

There are 4 different values for language it is working for English fine but for arabic they mention in there code that you have to use (“U”) as unicode. Then only it will work but even if i use U it is giving blank message. So is there a way to change the text to unitcode and then send it. Do we have to change the character set or something please your expert advise is appreciated in this regards.

static void Jobsms(Args _args)
{
System.Net.WebClient cust;
System.IO.Stream data;
System.IO.StreamReader reader;
System.String URLAddres;
Str SMSConfirmID;
str _message, _userId, _password, _senderId;
container secondContainer = [96569900945];
str _mobileNo= con2Str(secondContainer,",");

/*
L Language Type Possible Values:

  1. A for Arabic message
  2. B for Binary message
  3. L for English message
  4. U for Unicode message
    */

cust = new System.Net.WebClient();

_userId = ‘user1’;
_password = ‘pwd2’;
_message = "سلام كامران ";
_senderId = ‘sender1’;

URLAddres = "22.255.126.54/sms.aspx + _userId + “&P=” + _password + “&S=”+ _senderId + “&G=” + _mobileNo + “&M=” + _message + “&L=‘L’”;

data = cust.OpenRead(URLAddres);
reader = new System.IO.StreamReader(data);
SMSConfirmID = reader.ReadToEnd();
data.Close();
reader.Close();
info(SMSConfirmID);
}

First of all, try changing WebClient’s Encoding property.

Also, can you tell us more about “Language Type”. It looks like the parameter processed by the SMS gateway, right? In that case, if it doesn’t work as expected, you’ll have to the provider of the gateway.

You may want to intercept the message being sent (e.g. using Fiddler) and if it encoding is correct there, the problem is on the receiving side and not in AX.

Martin how can i change the encoding property and what should i changed it to. please can you give an example.

You can set the property by calling set_Encoding method, e.g. like cust.set_Encoding(System.Text.Encoding::UTF8). Learning how to use properties is import, if you develop with .NET Interop (as you do).

I don’t know what you have to provide, because I don’t have enough information about the problem. Consider analyzin what’s wrong before trying to fix it (see my last sentence in the previous reply for a suggestion). I also have zero information about your SMS gateway, so I don’t know what it expects. Experiment.

Martin how to convert a text to unicode and then save this unicode value in a variable please i need 1 example.

string originaldata = “ABC”;
string unicodedata;

unicodedata = ??

please just help me in this.

You don’t have to do anything. AX uses Unicode since version 4.0, therefore originaldata already is a Unicode string.