This one drove me nuts... I was getting HTTP 400 errors, and 10054 Errors. I thought it was the web server.
No. It's the inclusion of a SPACE character within a GET URL instead of %20. I've gone ahead and used the StringReplace> command, but if HTMLEncode could just do it, that would save people having to remember.
Decoding doesn't get convert it back either.
Add URLEncode as a function :D
Moderators: Dorian (MJT support), JRL
Add URLEncode as a function :D
Last edited by mightycpa on Tue Mar 16, 2021 3:15 pm, edited 1 time in total.
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey
- Dorian (MJT support)
- Automation Wizard
- Posts: 1398
- Joined: Sun Nov 03, 2002 3:19 am
Re: Add SPACE encoding to HTMLEncode/HTMLDecode
I have passed this on.
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Add SPACE encoding to HTMLEncode/HTMLDecode
Hi,
HTMLEncode/Decode encode and decode HTML, not URLs.
%20 is the URL encoding for a space character. + is also sometimes used.
But in HTML, space is just space. So these functions are working correctly. They are not for encoding/decoding URLs.
Here's a way you can do that:
https://www.mjtnet.com/blog/2018/04/02/ ... -requests/
HTMLEncode/Decode encode and decode HTML, not URLs.
%20 is the URL encoding for a space character. + is also sometimes used.
But in HTML, space is just space. So these functions are working correctly. They are not for encoding/decoding URLs.
Here's a way you can do that:
https://www.mjtnet.com/blog/2018/04/02/ ... -requests/
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Re: Add SPACE encoding to HTMLEncode/HTMLDecode
I see, HTMLEncode vs. URLEncode.
I've been doing StringReplace>source,SPACE,%20,result and that seems to work.
I've been doing StringReplace>source,SPACE,%20,result and that seems to work.
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey
- Dorian (MJT support)
- Automation Wizard
- Posts: 1398
- Joined: Sun Nov 03, 2002 3:19 am
Re: Add SPACE encoding to HTMLEncode/HTMLDecode
That's what I do too.
- Grovkillen
- Automation Wizard
- Posts: 1132
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: Add URLEncode as a function :D
Note to self and others....
Just use the "UnEscape" to replace ALL those URL escaped characters.
And the other way around is this:
Just use the "UnEscape" to replace ALL those URL escaped characters.
Code: Select all
Let>JSON_STRING=%22change%22:%22produktion-article-info-hyllplats%3E%3E%3EK1%3C%3C%3C%22,%22value%22:%22K112%22,%22job%22:%2247433-2%22,%22article%22:%22212-160-12000%22
VBEval>UnEscape("%JSON_STRING%"),JSON_STRING
//JSON_STRING="change":"produktion-article-info-hyllplats>>>K1<<<","value":"K112","job":"47433-2","article":"212-160-12000"
Code: Select all
Let>JSON_STRING="change":"produktion-article-info-hyllplats>>>K1<<<","value":"K112","job":"47433-2","article":"212-160-12000"
VBEval>Escape("%JSON_STRING%"),JSON_STRING
//JSON_STRING=%22change%22:%22produktion-article-info-hyllplats%3E%3E%3EK1%3C%3C%3C%22,%22value%22:%22K112%22,%22job%22:%2247433-2%22,%22article%22:%22212-160-12000%22