Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: to-url

From: tim:johnsons-web at: 5-Jan-2003 19:39

Okay Folks: Some of you are having your coffee and feeling bright-eyed and bushy-tailed. Me, I'm in the frozen North and at the end of a very short day but sleepy. Here's an attempt that would escape any none-url-acceptable char in the 'encode string. ; NOTE 'def is Andrew's 'fun/deep function esc-char: def[ch[char!]][ join "%" enbase/base to-string ch 16 ] url-str: def[str[string!]][ encode: "%&= " ; add any more from http rfc new-str: make string! (length? str) * 3 ; let's be generous repeat char str[ either found: find encode char [append new-str esc-char char] [append new-str char] ]new-str ] You think? Hack me up, it just gives me good code back! (But this really could be a native huh?) -tim- * Andrew Martin <[Al--Bri--xtra--co--nz]> [030105 19:19]:
> Carl's got it right here. > > Andrew Martin > ICQ: 26227169 http://valley.150m.com/ > -><- > > ----- Original Message ----- > From: "Carl Read" <[carl--cybercraft--co--nz]> > To: <[rebol-list--rebol--com]> > Sent: Monday, January 06, 2003 3:56 PM > Subject: [REBOL] Re: to-url > > > On 06-Jan-03, Tim Johnson wrote: > > > Hello : > > > I have some questions about to-url here: > > > supose I want to create a query-string in a url > > > that has letters like "?=&" inside of > > > the values. > > >>> to-url "Father & sons" > > > == Father & sons > > > ;yikes, shouldn't we get Father %26 son ('&' is hex 26, right?) > > > ; decoding this will give incorrect results, I think... > > > > > Comments and suggestions welcome > > > > I just searched google for "a & b" to see how it'd make its URL, and > > this is what it returned... > > > > > http://www.google.co.nz/search?q=a+%26+b&ie=ISO-8859-1&hl=en&btnG=Google+Sea > rch > > > > My guess would be that you'd convert to %26 if it's part of some text, > > but leave as-is if it's for breaking up the query. (A guess mind - > > others here will know the rules I'm sure.) > > > > -- > > Carl Read > > > > -- > > To unsubscribe from this list, please send an email to > > [rebol-request--rebol--com] with "unsubscribe" in the > > subject, without the quotes. > > > > -- > To unsubscribe from this list, please send an email to > [rebol-request--rebol--com] with "unsubscribe" in the > subject, without the quotes.
-- Tim Johnson <[tim--johnsons-web--com]> http://www.alaska-internet-solutions.com http://www.johnsons-web.com