Problem Encoding to ISO-8859-1

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • iamlost
    New Member
    • Dec 2009
    • 1

    #1

    Problem Encoding to ISO-8859-1

    Hi

    I'm trying to encode string to ISO-8859-1 and after send this data to a webservice.

    I'm using VB.NET 2008.

    I have the next code. It runs fine excepts the character +

    Code:
    baseurl = "http://www.myweb.com/api/sendsms.php"
                client = New WebClient
                client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)")
                client.QueryString.Add("user", user)
                client.QueryString.Add("password", pass)
                client.QueryString.Add("alias", myAlias)
                client.QueryString.Add("dest",  mobile)
                textoSms = Me.mmTexto.Text
                textoSms = System.Web.HttpUtility.UrlEncode(textoSms, System.Text.Encoding.GetEncoding("ISO-8859-1"))                
                client.QueryString.Add("message", textoSms)
                data = client.OpenRead(baseurl)
                reader = New StreamReader(data)
                s = reader.ReadToEnd()
                data.Close()
                reader.Close()

    Example:

    original string: 50+50
    string encoded to iso 8859-1: 50%2b50
    webservice receives: 5050

    Any help?
Working...