Need help with url encoding/Decoding

Nickle

Member
Licensed User
Longtime User
I am grateful for the response on my last post, my issue was resolved. Now I am passing values to a webservice url. one of the variables forming the request sometimes contains special characters or spaces which distorts the http request i am passing. I need help to encode/decode the content am passing in the request. The web service is created from php code.

The variable which sometimes contains the special characters is xbody as can be seen in the request below line of code.

B4X:
ExecuteRemoteQuery("http://localhost:10088/Countries/collector.php?xaddress="&xaddress&"&xbody="&xbody&"&smsread="&smsread&"&smsdate="&smsdate&"&smstime="&smstime&"&msgid="&msgid,1)
 

warwound

Expert
Licensed User
Longtime User
Best to use the StringUtils encode method.
It'll properly encode all special characters in a way that is compatible with the PHP urldecode function.

Be sure to only encode the GET key names (probably not required) and key values - don't use StringUtils to encode the entire URL or it won't work.

Martin.
 
Upvote 0
Top