Atozed Forums

Full Version: Webapplication.RunParams Encoding
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

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

When we inspect the WebApplication.RunParams, the strings are not the same as below ...
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.
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:

it will work as you expect. In that case + is encoded as %2B
We are using SA Indy (Running as Services).
The parameters are encoded using TNetEncoding.Base64.Encode
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.

"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."
(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 :-)
+ 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.