[mod_python] utf-8 encoding - still a problem

Graham Dumpleton grahamd at dscpl.com.au
Sat Feb 3 23:00:32 EST 2007


On 03/02/2007, at 7:49 AM, export at hope.cz wrote:

> Thank you all who recently offered a solution to my UTF-8 problem.
> So I added to my handler
>
> req.content_type = 'text/html ;charset=utf-8'
> req.write('''	<html>
> ....
> ...
>
> ...
> (</html>""".decode('utf8').encode('utf8'))
>
> But now when I try to call handler
> like http://www..../mod/uploadvideo.py?24795
> a download dialog is presented as if I wanted to download that script.
>
> But If I do NOT use
> charset=utf-8 in req.content_type
> the script works good( except NOT utf-8 coding).and no download  
> dialog is shown.
> Where can be a problem?

Does it still fail if you take out the space before the semicolon?  
Maybe your
web client is being very fussy.

Have you tried to use some means to look at the headers sent back by
mod_python in the response to verify what has actually been sent? There
are extensions to firefox to look at headers returned, but I think  
you can
also use tools like wget/curl to remember headers so you can look at  
them
as well.

Graham


More information about the Mod_python mailing list