Devin Asay wrote:
I'm working on a stack that launches stacks from the web with 'go stack
URL'.
I know there are certain characters that are illegal or unsafe in URL
strings. (See http://tools.ietf.org/html/rfc1738) These include space,
quote and a number of others. Most web browsers automatically escape
these characters for you, so, e.g., a space is converted to '%20' before
the browser sends the request to the server.
I'm about to start writing a function that checks a potential stack URL
for illegal and unsafe characters and converts them to escape sequences,
but I don't want to reinvent the wheel if such a thing already exists.
Am I right that there is no equivalent functionality built into Rev? I
know about URLEncode(), of course, but that serves a different
purpose--formatting strings for POSTing, rather than formatting strings
for retrieving files from a server (a GET request?) Am I understanding
this correctly?
I think you are right Devin, unfortunately. Anyway, you can't give the
whole url to urlencode as it will also encode the slashes and colons
etc. etc.
Looking at my php manual, I find php has 2 functions:
urlencode()
rawurlencode()
and the difference is described as the treatment of space: + in
urlencode, %20 in rawurlencode
This is a surmise, but I think that RR urlencode is the same as php's
identically named function. If so, a shortcut might be to replace the
spaces yourself before applying urlencode() which should deal with any
remaining problem characters
something like (untested)
put "http://www.whatever.com/" into tdomainpart
put "exciting content/big file.html" into tpath
replace space with "%20" in tpath
set itemdelimiter to "/"
put empty into t_assemble
repeat with i = 1 to the number of items in tpath
put urlencode(item i of tpath) into item i of tencodedpath
end repeat
put tdomainpart & tencodedpart into tencodedurl
A related issue is, are there characters that are disallowed as
filenames for rev stackfiles? I can't find any such list anywhere. I
suppose this would be determined by the host OS?
That's what I would expect. I would avoid naming a rev stack beginning
with a tilde though, because of the temp file made when saving.
Martin Baxter
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution