Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8319843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:27:01+00:00 2026-06-08T22:27:01+00:00

I am trying to pass a parameter to a python cgi script, this parameter

  • 0

I am trying to pass a parameter to a python cgi script, this parameter contains the plus operator.

 /cgi-bin/test.py?input=print%20"%20"%20"%20%20-+-\"

The python cgi script is simple:

#!/usr/bin/python -w
import cgi
fs = cgi.FieldStorage()

print "Content-type: text/plain\n"
strE=fs.getvalue("input")
print strE

my output is:

 print " " "  - -\"

I don’t understand why the ‘+’ plus operator is substituted by space,
How may i pass the ‘+’ plus operator?

EDIT

@Tom Anderson, answered my question, and i want to extend my question a bit more.

I have a java-script function that invokes gets the url with the parameters:

            <script type="text/javascript">

            function PostContentEditable(editableId,targetOutput)
            {
                        var texthtml = document.getElementById(editableId).innerHTML
                        var tmp = document.createElement("DIV");
                        tmp.innerHTML = texthtml ;
                        var str= tmp.textContent||tmp.innerText;

                        var xmlhttp;
                        if (str.length == 0){
                            document.getElementById(targetOutput).innerHTML = "";
                            return;
                        }
                        if(window.XMLHttpRequest){
                            xmlhttp=new XMLHttpRequest();
                        }
                        else{
                            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                        }
                        xmlhttp.onreadystatechange=function(){
                            if (xmlhttp.readyState==4 && xmlhttp.status==200){
                                 document.getElementById(targetOutput).innerHTML=xmlhttp.responseText;
                            }
                        }

                        xmlhttp.open("GET","../cgi-bin/exercise.py?input="+str,true);
                        xmlhttp.send();
            }
            </script>

Is there an automatic built-in function that replaces all special characters to what i need?

  str = escapeStringToNativeUrl(str) ?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T22:27:02+00:00Added an answer on June 8, 2026 at 10:27 pm

    In the query part of the URL, + is a special code that means a space.

    This is because the part of the HTML specification concerning forms specifies that form data is encoded as application/x-www-form-urlencoded in a query string. In that encoding, space characters are replaced by `+’.

    So, Python is correctly decoding your input.

    If you want to pass an actual plus, you will need to percent-encode it as %2B.

    In JavaScript, i believe the right way to build the query string is with encodeURIComponent.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to pass parameter from python page to another through the URL,this parameter(key
I am trying to pass a parameter as text which contains multiple ' -
I'm trying to pass 3 parameter to a script, where the 3rd parameter $_GET['value3']
I'm trying to write a simple Python script for my mobile phone to periodically
I am trying to pass a few parameter and a user input to a
I am trying to pass array parameter to SQL commnd in C# like below,
I am trying to pass the parameter, which is 'priceValue'. How can I pass
Possible Duplicate: pass parameter in g:remoteLink as result of javascript function I am trying
I am trying to pass a method in as a parameter to a method
I was trying to pass the current value of length as the default parameter

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.