Hi,
I've used an Inet variable to be able to use the HyperlinkToURL() function.
I thought it would be a good idea to use the CoderObject to UrlEncode() the url that I'm passing in.
My URL's can point to anything like "file://..." or "http(s)//...".
The problem I'm having is that the function encodes every character !
If I would use Appeon's example to create a url for HyperLinkToUrl(), it wouldn't work, since the colon and slashes and dots all would be changed to "%whatever".
Blob lblb_data
String ls_UrlStr
lblb_data = Blob("https://www.appeon.com", EncodingANSI!)
CoderObject lnv_CoderObject
lnv_CoderObject = Create CoderObject
ls_UrlStr = lnv_CoderObject.UrlEncode(lblb_data)
// above Appeon's example, below what I'd like to do with the result:
inet lnet_base
lnet_base = CREATE n_inet
SetPointer(hourglass!)
lnet_base.HyperlinkToURL( ls_UrlStr )
destroy lnet_base
The above code won't work.
If I don't urlencode my links, they work just fine. It seems the browsers themselves already automatically convert all parts that have to be urlencoded if my url contains any spaces or even "%" in them.
So ... is the urlencode function meant to be used for something else maybe?
Is there another function that would encode a url without changing what doens't need changing when it's a link to an internet address?
regards
In addition, referring to this recent post: https://community.appeon.com/index.php/qna/q-a/replace-spaces-with-20-so-i-can-view-link-in-browser , HyperLinkToUrl fails when the link starts with "file:///...." and when that url contains spaces.
The solution is to enclose the url with outer single quotes and the inner string with double quotes.
regards.