By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,162 Members | 1,061 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,162 IT Pros & Developers. It's quick & easy.

How to Send a UniCode String in XMLHTTP Query String?

nicebasic
P: 91
Hello everybody,

I'm trying to use an SMS Panel to send my messages online. The format for using their URL Service is like this:
Expand|Select|Wrap|Line Numbers
  1. http://YourSite.com/post/sendSMS.ashx?from="FromNumber"&to="ToNumber"&text="Message"&password="MyPassword"&username="MyUserName"
For example, if you wish to send "Hello friends" from "04155157981" to "1000457871" and your Username is "Richard" and your password is "Good_not", you should use the above command like this:
Expand|Select|Wrap|Line Numbers
  1. http://YourSite.com/post/sendSMS.ashx?from=04155157981&to=1000457871&text="Good_not"&password="Good_not"&username=Richard
I can use this command to send SMS online. If the SMS is sent successfully, the resulted page will show you a code. Code 1 shows that the SMS has been delivered successfully. If you view the HTML source code of the resulted page, you can only see a digit. In my case, since nearly all messages are successfully delivered, I see number 1 as the result.

I have no problem in sending messages that are in English, but this does not work for other languages. If you type the UniCode message in the address bar, it runs successfully, but from within an ASP Classic Page, it sends corrupted message which is not readable.

I tried to use the following code for ASP Classic, but it failed:
Expand|Select|Wrap|Line Numbers
  1. smsFrom = "04155157981"
  2. smsTo = "1000457871"
  3. smsText = "یک متن آزمایشی به زبان فارسی"
  4. smsPass = "Good_not"
  5. smsUser = "Richard"
  6.  
  7. url = "http://YourSite.com/post/sendSMS.ashx?from=<%=smsFrom%>&to=<%=smsTo%>&text=<%=smsText%>&password=<%=smsPass%>&username=<%=smsUser%>"
  8.  
  9.     set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
  10.     xmlhttp.open "GET", url, false
  11.     xmlhttp.send ""
  12.     Response.write xmlhttp.responseText
  13.     set xmlhttp = nothing
I searched the net for this problem. Some have suggested adding these lines to the beginning of your ASP page:
Expand|Select|Wrap|Line Numbers
  1. <%@ codepage=65001 Language=vbScript %>
  2. <% Response.CharSet = "utf-8" %>
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
I did so, but it didn't help. I'm really confused.

Does anyone know how to solve this problem?

Any suggestion will be appreciated.
Jul 17 '12 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.