I think that encode() in CGIDEV2 is an HTML encoding procedure rather than an a URL encoding procedure (and a pretty lightweight one at that).

-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx] On Behalf Of Charles Wilt
Sent: 19 September 2012 22:16
To: Web Enabling the AS400 / iSeries
Subject: Re: [WEB400] How do you pass a variable that contains a % character in it to the RPG program

I think CGIDEV2 has an encode() function you'd want to pass the input through...

Charles

On Wed, Sep 19, 2012 at 4:40 PM, Mark Murphy/STAR BASE Consulting Inc.
<mmurphy@xxxxxxxxxxxxxxx> wrote:
You need to encode it when you create the url so that

.Program.pgm?mode=view&key=freight%&id=k3

is encoded as

.Program.pgm?mode=view&key=freight%25&id=k3

Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx

-----web400-bounces@xxxxxxxxxxxx wrote: -----
To: "'Matt Lavinder'" <mlavinder@xxxxxxxxxxxxxxxxxxx>, "'Web Enabling
the AS400 / iSeries'" <web400@xxxxxxxxxxxx>
From: "Darryl Freinkel"
Sent by: web400-bounces@xxxxxxxxxxxx
Date: 09/19/2012 04:16PM
Subject: Re: [WEB400] How do you pass a variable that contains a % character in it to the RPG program

I understand this part, however, I pass 3 parameters example:



.Program.pgm?mode=view&key=freight%&id=k3



This is a CGIDEV2 program.



The program reads mode correctly but it gets confused with key and ID,
which it sees as 1 field. I see the value for key = freight%#@$ where
#@$ is some hex value. As a result, I cannot get to use the URLESCSEQ
or did I get this wrong?



How do I set this in the HTML HREF statement?



Darryl Freinkel | Assignment 400 Group, Inc.

Tel: 770.321.8562 ext 111 | Fax 770.321.8562



From: Matt Lavinder [mailto:mlavinder@xxxxxxxxxxxxxxxxxxx]
Sent: Wednesday, September 19, 2012 3:54 PM
To: Web Enabling the AS400 / iSeries
Cc: Darryl Freinkel
Subject: Re: [WEB400] How do you pass a variable that contains a %
character in it to the RPG program



The percent sign is a special character on a URL so you need to "encode".
Every percent needs to be replaced with %25.



Since you're replacing an actual percent sign it makes it a little
confusing. The % in %25 has nothing to do with your data. On a URL, %
is a way to indicate to the browser/server that next 2 positions of
the contain the hex code of a character. The hex code for the percent sign is 25.



So if your data was "my%percent" and it was passed on a URL, it would
need to be encoded "my%25percent".



If your text was "my percent", it would need to be encoded
"my%20percent", as 20 is the character code of space.



So you will use % when encoding special characters for a URL, which is
why your URL doesn't work.



If you are using CGIDEV2 and have a version released this year, it has
a new procedure called UrlEscSeq to make encoding URL parameters easy.


D inpString s 32767 varying
D outString s 32767 varying
*
C eval outString=UrlEscSeq(inpString)



On Wed, Sep 19, 2012 at 3:44 PM, Darryl Freinkel
<dfreinkel@xxxxxxxxxxxxxxxxx> wrote:

I have a situation in a web program where the percent sign is in
fields in a table. The fields display normally when rendered to the
browser, but when I try to use the field to go to an update page as a
passed parameter, the system/RPG gets confused with the % sign and
does not recognize it as a valid character in the parameter.



I cannot remember how to encapsulate or wrap these field values so
that I can read them normally in the RPG program.



How do we get around this type of error?



TIA

Darryl Freinkel

Assignment 400 Group, Inc.

Tel: 770.321.8562 ext 111 | Fax 770.321.8562 | 2247 La Salle Dr,
Marietta GA, 30062, USA | PO Box 72556, Marietta, GA 30007-2556



--

This is the Web Enabling the AS400 / iSeries (WEB400) mailing list To
post a message email: WEB400@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/web400.



--

This is the Web Enabling the AS400 / iSeries (WEB400) mailing list To
post a message email: WEB400@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/web400.

--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list To
post a message email: WEB400@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/web400.

--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list To post a message email: WEB400@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/web400.


NOTICE: The information in this electronic mail transmission is intended by CoralTree Systems Ltd for the use of the named individuals or entity to which it is directed and may contain information that is privileged or otherwise confidential. If you have received this electronic mail transmission in error, please delete it from your system without copying or forwarding it, and notify the sender of the error by reply email or by telephone, so that the sender's address records can be corrected.



--------------------------------------------------------------------------------


CoralTree Systems Limited
25 Barnes Wallis Road
Segensworth East, Fareham
PO15 5TT

Company Registration Number 5021022.
Registered Office:
12-14 Carlton Place
Southampton, UK
SO15 2EA
VAT Registration Number 834 1020 74.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.