"philotas" wrote:
I need to use the Escape function of roUrlTransfer to create a working URL.
However since the Escape function is tied to roUrlTransfer I cannot create an object on the SG render thread.
And it is overkill to have to create a roUrlTransfer anyways .. especially in another thread just to manipulate a string.
So how can I use the Escape function? Shouldn't that function be a global function instead of belonging to ifUrlTransfer?
"EnTerr" wrote:
Hahaha, that's a good one!
You can't - sorry.
As an excercise of ridiculousness, maybe create a persistent "UrlEncoder" Task thread, with "input" and "output" field, then put observer on the output and shove the URL in the input, wait for a call back... that'd be a good Karnapidasana
"philotas" wrote:
haha, good one too! Sometimes feeling the same!
function url_encode(s):
unreserved = createObject("roRegex", "[\w\d\-_.]", "")
ba = createObject("roByteArray")
res = ""
for each ch in s.split(""):
if unreserved.isMatch(ch):
res += ch
else:
ba.fromAsciiString(ch): hex = ba.toHexString()
for i = 1 to len(hex) step 2: res += "%" + mid(hex,i,2): next
end if
next
return res
end function
"TheEndless" wrote:
I'm curious about the use-case. What is the situation in which you need to URL encode a value in a separate thread from the actual web request?
"TheEndless" wrote:
I'm curious about the use-case. What is the situation in which you need to URL encode a value in a separate thread from the actual web request?