Help needed with python unicode cgi-bin script

weheh weheh at verizon.net
Tue Dec 11 19:03:36 EST 2007


> What does the browser say what the encoding of the page is?
>
> What browser are you using, and did you configure it to default to
> UTF-8 for all pages? (which you should not have done)
>
Browser is both IE and Firefox. IE is defaulting to UTF8. If I force it to 
"Encoding > Western European (Windows)" it shows the ñ. The browser encoding 
"Autoselect" feature is enabled, yet it always seems to default to UTF8. Any 
idea how to change that?

Is there something I can put in html that forces it to do that?

I'm using Apache and have the following line in my http.conf file:

AddDefaultCharset utf-8

Is this a problem?

> Try "telnet server 80", then type
>
> GET /path HTTP/1.1<enter>
> Host: server<enter>
> <enter>
>
> and report what response from the server is (the complete one,
> not just the character in question)
>

OK, telnet session yields this:

HTTP/1.1 200 OK
Date: Tue, 11 Dec 2007 23:58:02 GMT
Server: Apache
Transfer-Encoding: chunked
Content-Type: text/html; charset=utf-8

1f8
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.or
g/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
                                          <html 
xmlns="http://www.w3.org/1999/xh
tml" lang="en,sp,fr" xml:lang="en,sp,fr">
                                         <head>
                                               <meta 
http-equiv="content-type" c
ontent="text/html; charset=utf8" />
                                   <meta http-equiv="content-language" 
content="
en,fr,sp" />
            </head>
                   <body>

                         <p> a±o
# first print</p>
                 <p> 'a\xf1o\r\n' # second print</p>
                                                    <p> 'a\xf1o\r\n' # third 
pri
nt</p>
      <p> 'a\xf1o\r\n' # third print</p>

                                        </body>
                                               </html>


0



Connection to host lost.





More information about the Python-list mailing list