URL Encoding lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- RobA · 2021-12-10 21:52 Hi all, I need to pass some arbitrary text as a query string to a URL that will be opened in the default browser (I'm using Windows) via OpenURL. Obviously, the query string will need to be URLEncoded - is there a standard function lurking in a unit somewhere for this, or do I need to roll my own? A quick google search didn't come up with anything, but I may have been searching on the wrong terms. TIA Rob ---------------------------------------------------------------------- lainz · 2021-12-10 22:40 https://forum.lazarus.freepascal.org/index.php?topic=15088.0 https://forum.lazarus.freepascal.org/index.php/topic,9184.msg329368.ht ml#msg329368 ---------------------------------------------------------------------- RobA · 2021-12-10 23:11 Perfect, thank you! ---------------------------------------------------------------------- AlexTP · 2021-12-11 00:25 I wrote this reply to the wiki - https://wiki.freepascal.org/URL_encoding/decoding ---------------------------------------------------------------------- Josh · 2021-12-11 00:52 checkout the unit httpprotocol it has decode/encode funtionaility as well as other funtions you may find usefull.. just add it to your uses section, ---------------------------------------------------------------------- Josh · 2021-12-11 11:10 hi alextp, just looked at wiki question should safemask include '('  ')' '$' and  '!' ? ---------------------------------------------------------------------- AlexTP · 2021-12-11 11:16 Maybe, I just copied the ready code from the forum. ---------------------------------------------------------------------- Josh · 2021-12-11 11:41 hi just checking someof my code, i also whitelist these aswell ',/;#?&:+=' but if my whitelist is correct then, hhtpprotocol unit may need adjusting. so my list is A..Z a..z 0..9 ' * @ . _ - , / ; # ? & : + = ( ) $ ! I also whitelisted ~ but commented out; can't remember why now though Does this need verification and checking? ---------------------------------------------------------------------- AlexTP · 2021-12-11 13:07 If you want to post the FPC issue about it, then yes, it needs verification first. compare it with some C++ libs, e.g.