Wouldn’t you just use the EncodeURLComponent() for your Base64 value?
Encoding URL information, to be used in either HTTP GET or POST requests, applies to the “value” of an argument, where that value may contain URL reserved characters like /, =, + and spaces. The encoding function shouldn’t care whether the value is a Base64 string or just some other string type value.
var url = 'http://example.com/redirectTo?target=' + encodeURIComponent('http://example.org/')
It’s the value of “target” that needs to be URL encoded. Which would result in a value like http%3a%2f%2fexample.org%2f.
I’m sure constructing a URL “string” in Xojo to contain your Base64 information would be similar, except using the EncodeURLComponent() method of course. Something like:
Dim url As String = 'http://example.com/redirectTo?target=' + EncodeURLComponent(myBase64StringVar)
Note: Base64 strings tend to be very long (depending on your content) and there are limits to how long a URL can be, before browsers, proxies or other network points will fail to handle the request.
The upper limit to the length of URL is difficult to gauge, because it depends on many factors, but I would put that limit at about 2,000 characters. Your mileage may vary.
I hope that helps, but my apologies if I misunderstood what you’re trying to do.
Edit: I realize you’re offering an alternative solution @Kem Tekinay, but I guess my first thought was about whether you’re controlling both ends of the URL (the sender and the recipient). Because both would require using your custom function. Whereas sending with an RFC standards compliant URL encoding method would allow the recipient to decode the value using the corresponding standards compliant method as well (where the recipient may be using a different platform than Xojo).