Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Webapplication.RunParams Encoding
#1
Hi 

We pass encoded, encrypted parameters to our Intraweb 15 applications, as shown below ...
Code:
WebApplication.ReferringURL 'http://127.0.0.1:8888/$/start?0001=wr7Ct+KApsOJw4rDoMON'

When we inspect the WebApplication.RunParams, the strings are not the same as below ...
Code:
WebApplication.RunParams.ValuefromIndex[0]: 'wr7Ct KApsOJw4rDoMON'

The encoding for RunParams is 'TMBCSEncoding', from (WebApplication.RunParams.Encoding.ToString).

The problem is that we do not know how to change the encoding for 'RunParams' to UTF8.

Any help would be appreciated.

Thanks, Pieter.
Reply
#2
The problem is not exactly the encoding.

I'm not sure which type of application you are using (ISAPI, SA Indy or SA Http.sys) but the plus char is decoded as a space.

If you post this instead: http://127.0.0.1:8888/?0001=wr7Ct%2BKApsOJw4rDoMON

it will work as you expect. In that case + is encoded as %2B
Reply
#3
We are using SA Indy (Running as Services).
The parameters are encoded using TNetEncoding.Base64.Encode
Reply
#4
Base64 encoding is not the same a URL encoding. You need to encode using something like Indy's URL encode. The problem is that you are using the wrong method to encode your URLs.
Reply
#5
https://www.w3schools.com/tags/ref_urlencode.asp

"URL Encoding (Percent Encoding)

URLs can only be sent over the Internet using the ASCII character-set.

Since URLs often contain characters outside the ASCII set, the URL has to be converted into a valid ASCII format.

URL encoding replaces unsafe ASCII characters with a "%" followed by two hexadecimal digits.

URLs cannot contain spaces. URL encoding normally replaces a space with a plus (+) sign or with %20."
Reply
#6
(04-02-2019, 11:10 AM)pvanwyk Wrote: We are using SA Indy (Running as Services).
The parameters are encoded using TNetEncoding.Base64.Encode

Historically (at least) "+" chars in URLs are decoded as spaces because, again historically, several user agents - including some browsers - use to encode spaces using "+" chars. 
If you encode + as %2B it will work. 100% guaranteed :-)
Reply
#7
+ to space is part of the actual specification. But its only in certain areas and I'd have to look it up to remember which.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)