Atozed Forums
Webapplication.RunParams Encoding - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html)
+--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html)
+---- Forum: English (https://www.atozed.com/forums/forum-16.html)
+----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html)
+----- Thread: Webapplication.RunParams Encoding (/thread-1012.html)



Webapplication.RunParams Encoding - pvanwyk - 03-28-2019

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.


RE: Webapplication.RunParams Encoding - Alexandre Machado - 03-30-2019

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


RE: Webapplication.RunParams Encoding - pvanwyk - 04-02-2019

We are using SA Indy (Running as Services).
The parameters are encoded using TNetEncoding.Base64.Encode


RE: Webapplication.RunParams Encoding - kudzu - 04-02-2019

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.


RE: Webapplication.RunParams Encoding - kudzu - 04-02-2019

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."


RE: Webapplication.RunParams Encoding - Alexandre Machado - 04-03-2019

(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 :-)


RE: Webapplication.RunParams Encoding - kudzu - 04-03-2019

+ 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.