New topic: Encode cgi variable string to pass into ShowURL
<http://forums.realsoftware.com/viewtopic.php?t=44777> Page 1 of 1 [ 5 posts ] Previous topic | Next topic Author Message torrid Post subject: Encode cgi variable string to pass into ShowURLPosted: Thu Jul 19, 2012 4:05 pm Joined: Sat Jun 04, 2011 8:29 am Posts: 319 In order to facilitate ordering and key requests... we append the customer's name, email and software id into cgi variables that are appended to the url. Typically you have to URL encode that string since their name could contain characters like a space, period, etc. Easiest way is to just blindly URL encode it. I have a routine from VB6 to do this but it is cumbersome to translate to RB... and I saw the encoding functionality in RB... but not sure which if any of the encodings to use. fullURL = DefineEncoding(aURLwCGIvars, Encodings.????) ShowURL(fullURL) Suggestions? _________________ Currently using: Windows XP Pro SP3 Real Studio 2011 Release 4.3 Enterprise and Mac OS 10.7.3 Real Studio 2011 Release 4.3 Enterprise (finally also compiled on Mac) Top jlawrence Post subject: Re: Encode cgi variable string to pass into ShowURLPosted: Thu Jul 19, 2012 4:14 pm Joined: Thu Dec 16, 2010 1:22 pm Posts: 159 Check out the EncodeURLComponent and DecodeURLComponent methods in the Language Reference. I think that's what you're looking for Top charonn0 Post subject: Re: Encode cgi variable string to pass into ShowURLPosted: Thu Jul 19, 2012 4:15 pm Joined: Mon Apr 02, 2007 2:08 am Posts: 848 Location: San Francisco, CA, USA DefineEncoding refers to character encoding (e.g. ASCII, UTF-8, etc) rather than URL-style encoding. To encode/decode URLs use EncodeURLComponent and DecodeURLComponent _________________ Boredom Software Top torrid Post subject: Re: Encode cgi variable string to pass into ShowURLPosted: Thu Jul 19, 2012 5:28 pm Joined: Sat Jun 04, 2011 8:29 am Posts: 319 OK thanks.... but (in case others read this later) note you have to call that on each cgi var val separately.... that does not encode an entire url string with multiple cgi variables.... The code I had in VB would encode the url and for example ignore the ? and other component separators that were valid in context. Anyway I figured it out and got it working. Thanks. Top charonn0 Post subject: Re: Encode cgi variable string to pass into ShowURLPosted: Thu Jul 19, 2012 5:32 pm Joined: Mon Apr 02, 2007 2:08 am Posts: 848 Location: San Francisco, CA, USA I wrote a URI handling class recently which allows you to build a URL piece-by-piece, swap out parts, etc. Maybe you can make use of it: https://github.com/charonn0/RB-URI _________________ Boredom Software Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 5 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
