× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Is your question why the "get environment variable" routine doesn't do URL decoding?   Basically, the answer is... because its purpose is to get environment variables.  How many environment variables are URL-encoded?  Only QUERY_STRING -- of the millions of environment variables, this is the only one.

I recommend that you do not use QtmhGetEnv(), it is a very clumsy routine.  Use the standard getenv() API instead, this is much simpler to use, and is a standard used on many platforms. https://www.ibm.com/docs/en/i/7.4?topic=ssw_ibm_i_74/apis/evgetenv.htm

But, that assumes that your goal is to retrieve an environment variable.  If your actual goal is to write web applications, please consider using one of the toolkits that are out there for this purpose...  You don't want to code everything yourself, especially if you are a beginner (and you are quite clearly a beginner!)  The most popular free one for RPG is CGIDEV2.  But, there are others, and there are MUCH better commercial offerings. (The company I work for makes one, "Profound UI".  But many other vendors sell web dev tools for RPG as well.)

If you really insist on writing everything yourself, IBM *does* provide routines for parsing web input from QUERY_STRING or STDIN.   For example:

https://www.ibm.com/docs/en/i/7.4?topic=ssw_ibm_i_74/rzaie/rzaieapi_qzhbcgiparse.htm

or the easier to use (but less versatile) https://www.ibm.com/docs/en/i/7.4?topic=ssw_ibm_i_74/rzaie/rzaieapi_qtmhcvtdb.htm

Or you could write your own URL-decode routines, it's not difficult.   Though, with all of the great JavaScript frameworks out there today that communicate with the server via JSON (or older XML) I wonder why someone would be interested in parsing URL-encoded name/value pairs in 2021?   Code in a Web 2.0 fashion and use a JS framework.  True, its an extra thing you'll have to learn, but it will save you a lot of time in the long run, and spare you the need to do clumsy coding.  With modern frameworks you can just use DATA-INTO and DATA-GEN, it makes it super-easy.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.