classification
Title: Runs normal as console script but falls as CGI
Type: behavior Stage:
Components: Interpreter Core, Library (Lib), Unicode Versions: Python 3.2, Python 3.1, 3rd party
process
Status: pending Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Nick.Rowan, eric.araujo, ezio.melotti, petri.lehtinen
Priority: normal Keywords:

Created on 2011-11-03 03:22 by Nick.Rowan, last changed 2011-11-12 18:23 by petri.lehtinen.

Files
File name Uploaded Description Edit
Test.py Nick.Rowan, 2011-11-03 03:22 CGI script
Messages (3)
msg146893 - (view) Author: Nick Rowan (Nick.Rowan) Date: 2011-11-03 03:22
There is a Python script that tries to print a message in Russian language. It's okay when script runs in console, but it causes DecodeUnicodeError if it invokes as CGI.
msg146906 - (view) Author: Petri Lehtinen (petri.lehtinen) * (Python committer) Date: 2011-11-03 08:41
How are you running the CGI script? Are you sure that the PYTHONIOENCODING environment variable isn't set by the HTTP server?
msg147475 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-11-12 11:27
The contents are valid UTF-8; the problem does not seem related to PYTHONIOENCODING (run “python3.2 Test.py | cat” so that stdout is not a tty; this used to be buggy in 2.x, hence PYTHONIOENCODING, but in 3.x the encoding of stdout is UTF-8 even in a pipeline).

Nick, we’ll need more info about your setup, as well as the full traceback.  Thanks!
History
Date User Action Args
2011-11-12 18:23:36petri.lehtinensetstatus: open -> pending
2011-11-12 11:27:53eric.araujosetnosy: + eric.araujo
messages: + msg147475
2011-11-03 08:41:00petri.lehtinensetnosy: + petri.lehtinen
messages: + msg146906
2011-11-03 03:22:14Nick.Rowancreate