[mod_python] utf-8 encoding - still a problem

Jim Gallacher jpg at jgassociates.ca
Sun Feb 4 12:28:08 EST 2007


Graham Dumpleton wrote:
> 
> 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, 

I find the Web Developer extension to be handy for this and so much 
more. See https://addons.mozilla.org/firefox/60/

> but I think you can
> also use tools like wget/curl to remember headers so you can look at them
> as well.

wget should be in everyone's toolkit.

Jim


More information about the Mod_python mailing list