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 4042184
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:58:26+00:00 2026-05-20T12:58:26+00:00

A while ago, I had noticed that when encoding a map name: value to

  • 0

A while ago, I had noticed that when encoding a map name: value to 'application/x-www-form-urlencoded, it renders something like that (here I use Python):

>>> from urllib import urlencode
>>> urlencode({'hello': '', 'blabla': 'hihi'})
'blabla=hihi&hello='

But the parsing (at least with Python), just strips the pairs that have an empty value :

>>> from urlparse import parse_qs
>>> parse_qs('blabla=hihi&hello=')
{'blabla': ['hihi']}

So … is it the standard behaviour ? Where can I find the reference on how www-form-urlencoded should be parsed ? I have googled a while, found the RFCs for uris, W3c docs for forms, and so on but nothing about how the empty values should be treated. Can somebody give me a pointer to that ???

  • 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-05-20T12:58:26+00:00Added an answer on May 20, 2026 at 12:58 pm

    As far as I know, there is no “standard” for this. The only thing that is described (in the html spec, as you have found out), is how a browser should encode form data. What you want to do (or not) with empty values is up to you.

    Note that urlparse.parse_qs() has an optional parameter, keep_blank_values that allows you to control how it should handle those:

    >>> from urlparse import parse_qs
    >>> parse_qs('blabla=hihi&hello=', keep_blank_values=True)
    {'blabla': ['hihi'], 'hello': ['']}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A while ago I had a query that I ran quite a lot for
I had a problem a while ago whilst using Solaris that I wanted to
A while ago, I had a discussion with a colleague about how to insert
A while a go I had to developed a music site that allowed audio
A while ago, I came across some code that marked a data member of
A while ago another question referred to the (possibly urban tale) statistic that ...
A while ago I had asked how to make a collapsible comment box like
A while ago I had a similar question when using Class.getMethod and autoboxing, and
A while ago I had to upgrade some servers from Python 2.4 to Python
Had the following as an interview question a while ago and choked so bad

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.