> Date: Thu, 24 Jun 2010 14:27:59 -0400 > From: [email protected] > Subject: Re: [CMS-PIPELINES] URL encoding? > To: [email protected] > > Mark's works great, and while technically correct, most people only want > the limited set of chars encoded. >
Version 2 below! > > In the original WebShare, (available from Dave Jones at > > http://www.vsoft-software.com/webshare.vmarc > > there was a URL decoding stage (WEBSRVDC REXX). It contains several > change stages. As gil alludes, order matters. This looks like it translates the other way from %40 to '@', for example. Mark /**/ address command url = 'http://somewhere.anyco.com/~owner/string_of_stuff_includ...@signs/more.stuff' OK_AS_IS = 'abcdefghijklmnopqrstuvwxyz' /* Lower */ OK_AS_IS = OK_AS_IS || translate(OK_AS_IS) /* Upper */ OK_AS_IS = OK_AS_IS || '0123456789' /* Numeric */ OK_AS_IS = OK_AS_IS || ':/._-' /* Special */ 'PIPE(end ?)|', 'VAR URL |', 'SPECS FS / F1.3 1 WRITE F4-* 1 |', /* Split into two pieces */ 'T: TAKE 1 |', /* Use the 1st piece as-is */ 'F1: FANINANY |', 'JOIN * \/\ |', /* Pull them all back together */ 'VAR NEW_URL', /* Voila! */ '?', 'T: |', 'DEBLOCK 1 |', 'L: LOOKUP 1.1 1.1 DETAILS |', 'F2: FANINANY |', /* Pull 2nd part back together */ 'JOIN * |', 'F1:', '?', 'L: |', 'XLATE E2A |', /* Convert 2nd piece to ASCII */ 'SPECS 1-* C2X 1 |', /* Hex-ify */ 'SPECS /%/ 1 1.2 2 |', /* Add a '%' prefix */ 'F2:', '?', 'VAR OK_AS_IS |', 'DEBLOCK 1 |', 'L:' say url say new_url exit Input URL: http://somewhere.anyco.com/~owner/string_of_stuff_includ...@signs/more.stuff converts to: http://somewhere.anyco.com/%7Eowner/string_of_stuff_including%40signs/more.stuff The above example could probably be simplified by treating the entire URL the same, rather than splitting it in two first. I assume (not certain though) that a DNS name can't include any of the exotic characters that need the %-sign treatment. _________________________________________________________________ The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail. http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4
