[Python-Dev] Can the cgi module be made Unicode-aware? (original) (raw)

Barry A. Warsaw barry@zope.com
Thu, 11 Apr 2002 10:15:18 -0400


"SM" == Skip Montanaro <skip@pobox.com> writes:

SM> I keep trying to handle various places in my code where I can
SM> get input in non-ASCII encodings.  Today I realized the cgi
SM> module does nothing to translate Unicode data into unicode
SM> objects.  I see in one instance that I am getting data that is
SM> clearly utf-8 encoded, but I see nothing in the CGI script's
SM> environment variables to suggest the client web browser told
SM> the server how the data was encoded other than the obvious
SM> "Content-Type: application/x-www-form-urlencoded".  Is utf-8
SM> implied for the data once the url encoding has been reversed?

If the data is encoded in a non-ascii character set, wouldn't (or shouldn't) the Content-Type: header include a charset="xxx" parameter?

-Barry