I am working on a web application with a number of variables on which the user is expected to input data, in which often empty Location and / or plus sign
The data is usually sent through the with either What is the note : Thanks in advance for any help. Examples : As a request in the comment, here is a (simplified) sample of some code that triggers this issue. HTML Pearl form with default values After typing and running server-side code, the value of Update: On Ubuntu Using Apache has run a simple test. My HTML file looks like this: My Perl program looks like this: When I visited the page and clicked the 'Submit' button If pressed, then the browser URL I think that looks like the behavior of watching. When sending a browser, the browser correctly encodes the plus sign on% 2B. The CGI module decodes the value when I access it. You need to know that your browser (or other customers you are using to send these requests ) CGI is not following the speck. GET requests; Or
application / x-www-form-urlencoded content-type header
POST Code> Vars () and
param from the
CGI module of Pearl, but change the signals in both of these methods in
+ Insist on
CGI module
+ provides any mechanism to preserve signals; Or I should manually parse
CGI and password input
Large amounts of forms (More than a hundred), and being a CGI pre-processing in a central utility library, I am very biased towards server-side solutions rather than a client-side approach (in other words, I deal with it)
form action = "/ cgi-bin / some -script.pl">
Use CGI; my $ some_variable = CGI :: param ('some_field');
$ some_variable is
"1 is 2" (There are three locations between 1, either site or Browser may be covered in one place) ; The desired result is to get value
"1 + 2 2" in that value. Plus sign means the empty space in CGI parameters, it is in the CGI spec, any HTTP client that sends you more signals, this means that some Also, there is no problem in your CGI program (which is doing the right thing). The problem is in the HTTP client who is sending you more signals, which is more than that. To interpret as a sign The correct way to send a plus sign as a parameter in the CGI program is to encode it as a% 2B
gt; Top & gt; & Lt; title & gt; Test & lt; / title & gt; & lt; / head & gt; Body & gt; & lt; h1 & gt; Test & lt; / h1 & gt; & lt; Form action = "/ cgi-bin / param" & gt; & lt; input name = "some_field" value = "1 + 1 2 "" gt; & lt; input name = "submit" type = "submit" value = "submit" & gt; & Lt; / Form & gt; & Lt; / Body & gt; & Lt; / Html & gt;
#! / Usr / bin / perl strict; Use warnings; Use 5.010; Use CGI Qi [Header param]; Print header (-type = & gt; 'text / plain'); ("$ _ - & gt;" says, ':', the ultimate ($ _);}
http: // localhost / cgi-bin / param? Some_field = 1 +% 2B + 1 + is +2 and submit = submit and is displayed below: < / P>
some_field -> 1 + 1 is 2 submit -> submit >>
Comments
Post a Comment