Sending Arabic SMS through HTTP

Sending Arabic SMS through HTTP SearchSearch
Author Message
fahim
New member
Username: Fahimanwar

Post Number: 1
Registered: 04-2012
Posted on Saturday, April 21, 2012 - 06:41 pm:   

Hi Team,
I am trying to send sms with Arabic text, In one of your thread (http://support.nowsms.com/discus/messages/1/5754.html) i got information to send it through UTF8 Encoding, I am developing it in C#. Problem is how can i convert to %XX format. I hope you understood my point,

Please help me as i am just stuck in this point.

thanks
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 3920
Registered: 08-2008
Posted on Saturday, April 21, 2012 - 07:34 pm:   

Hi,

The %XX encoding is called URL encoding. I'm sure if you Google that term together with C# you will find some code for this.

Note also that if you do not want to convert to UTF-8, you can keep the text in Arabic, just include the parameter &charset=iso-8859-6 in the URL to signal which character set you are using.

--
Des
NowSMS Support
fahim
New member
Username: Fahimanwar

Post Number: 2
Registered: 04-2012
Posted on Sunday, April 22, 2012 - 05:26 am:   

Hi Thanks for reply,

I tried by doing not converting it to UTF-8 and passing charset with URL but its giving me some other charachters rather than the original message, i am not sure is because of browser or some other settings.
I will try to find some URL encoding but please confirm do i need to convert whole URL or only text message.
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 3922
Registered: 08-2008
Posted on Sunday, April 22, 2012 - 12:16 pm:   

Hi,

The same text works OK if you submit using the web form, right? (I am referring to this: http://www.nowsms.com/doc/web-menu-interface/send-text-message). If it does not work there, we need more details on your configuration and need to troubleshoot why.

If that interface works OK, then yes, UTF-8 and URL Encoding is the correct next step. Only URL encode the text value part, not the whole URL.

Another tip...enable the SMSDEBUG.LOG. In it you will see the URL received by NowSMS. Here you can also see the URL submitted by the form when sending test messages from the web interface. You can compare that with the URL your program is generating to determine the problem.

--
Des
NowSMS Support
fahim
New member
Username: Fahimanwar

Post Number: 3
Registered: 04-2012
Posted on Monday, April 23, 2012 - 04:48 pm:   

From Website its working fine mean i am getting arabic message. I checked into SMSDebug Log

19:31:24:977 [11] ThreadProcessConnection: Processing request /?PhoneNumber=009XXXXXXXXXX&Text=%D9%84%D8%A7%D8%AA%D8%B4%D8%B3%D9%8A%D8%AA%D8%A 7%D8%B4%D8%B3%D9%8A%D9%84%D8%A7%D8%AA%D8%A7%D9%84&Sender=123456&charset=iso-8859 -6
19:31:24:977 [11] Debug: 1 recipient entries
19:31:24:978 [11] UTF8StringRequiresUnicodeEncoding: Translate to/from GSM string results in loss of data
19:31:24:978 [11] UTF8StringRequiresUnicodeEncoding: ظ„ط§طھط´ط³ظٹطھط§ط´ط³ظٹظ„ط§طھط§ظ„
19:31:24:978 [11] UTF8StringRequiresUnicodeEncoding: é@@§7ù'73ù7ù§7'38ùyù7§ù7§@
19:31:24:978 [11] ThreadProcessConnection: SMS message must be submitted with Unicode
fahim
New member
Username: Fahimanwar

Post Number: 4
Registered: 04-2012
Posted on Monday, April 23, 2012 - 06:11 pm:   

I am just confused as NOW SMS Website is sending correct message, now as you told me to use that charachter set without changing arabic string it should work, but why its not working.. please help me out as i am halt on this point and still have to work alot ....
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 3923
Registered: 08-2008
Posted on Monday, April 23, 2012 - 07:03 pm:   

The URL request that you are showing me above includes "&charset=iso-8859-6" in the URL, so that request is not from the NowSMS web site.'

The NowSMS web site always submits using UTF-8.

What I am suggesting is that you look at the URL shown in the log from when you submit from web site.

Compare that to what you see when you convert to UTF-8 and URL encode. (Do not include charset= parameter in this case.) What is different?

Using Arabic codes and charset=iso-8859-6 should work. But I cannot read/write Arabic, so I cannot explain why your example above does not work.

Except ... when I look at your URL encoded string of text, I do see smoething suspicious:


quote:

%D9%84%D8%A7%D8%AA%D8%B4%D8%B3%D9%8A%D8%AA%D8%A7%D8%B4%D8%B3%D9%8A%D9%84%D8%A7%D 8%AA%D8%A7%D9%84




I look at the iso-8859-6 character set at the following link:

http://en.wikipedia.org/wiki/ISO/IEC_8859-6

The second character in your text ... %84 is not valid in iso-8859-6.

So I am not sure what character set you are working on in the first place.

However, if I assume your text is UTF-8 encoded, I would interpet the first two bytes as %D9 %84, converting from URL encoded UTF-8 to Unicode is 0x644, or ل (Arabic letter LAM).

Maybe your text is already in UTF-8 format, and if so, adding "&charset=iso-8859-6" is causing it to be interpreted wrong.

--
Des
NowSMS Support
fahim
New member
Username: Fahimanwar

Post Number: 5
Registered: 04-2012
Posted on Monday, April 23, 2012 - 07:50 pm:   

Hi

I am surprised that its working, i am now simply passing arabic text and its coming...
http://127.0.0.1:8800/?PhoneNumber=00XXXXXXXX&Text=انا حبى&Sender=123456
http://127.0.0.1:8800/?PhoneNumber=00XXXXXXX&Text=I Love You
&Sender=123456

I just removed that charset from the link...
if there is some thing you want to share on this please let me know this will be great help
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 3926
Registered: 08-2008
Posted on Tuesday, April 24, 2012 - 07:55 pm:   

Hi,

I'm glad to hear it. I can only figure that your application was already working with text in UTF-8 format.

This is frequently the case, especially when dealing with web apps.

Perhaps I did not understand your original question. The "&charset=xxxx" parameter tells NowSMS what character set the text is encoded in. The default, if this parameter is not included, is UTF-8.

--
Des
NowSMS Support