How to Send a UniCode String in XMLHTTP Query String?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nicebasic
    New Member
    • Aug 2010
    • 91

    How to Send a UniCode String in XMLHTTP Query String?

    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:
    Code:
    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 "0415515798 1" to "1000457871 " and your Username is "Richard" and your password is "Good_not", you should use the above command like this:
    Code:
    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:
    Code:
    smsFrom = "04155157981"
    smsTo = "1000457871"
    smsText = "یک متن آزمایشی به زبان فارسی"
    smsPass = "Good_not"
    smsUser = "Richard"
    
    url = "http://YourSite.com/post/sendSMS.ashx?from=<%=smsFrom%>&to=<%=smsTo%>&text=<%=smsText%>&password=<%=smsPass%>&username=<%=smsUser%>"
    
        set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
        xmlhttp.open "GET", url, false
        xmlhttp.send ""
        Response.write xmlhttp.responseText
        set xmlhttp = nothing
    I searched the net for this problem. Some have suggested adding these lines to the beginning of your ASP page:
    Code:
    <%@ codepage=65001 Language=vbScript %>
    <% Response.CharSet = "utf-8" %>
    <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.
Working...