Help needed with python unicode cgi-bin script
"Martin v. Löwis"
martin at v.loewis.de
Mon Dec 10 02:51:03 EST 2007
> My problem is more complex than this, but how about I boil down one sticking
> point for starters. I have a file with a Spanish word in it, "años", which I
> wish to read with:
What is the encoding of that file? Without a correct answer to that
question, you will not be able to achieve what you want.
Possible answers are "iso-8859-1", "utf-8", "windows-1252", and "cp850"
(these all support the word "años")
> Instead of seeing "año" I see "a?o". BAD BAD BAD
I don't see anything here. Where do you see the question mark? Did you
perhaps run the CGI script in a web server, and pointed your web browser
to the web page, and saw the question mark in the web browser?
> WHAT GIVES?
Sending "Content-type: text/html" is not enough. The web browser needs
to know what the encoding is. So you should send
Content-type: text/html; charset="your-encoding-here"
Use "extras/page information" in Firefox to find out what the web
browser thinks the encoding of the page is.
Regards,
Martin
P.S. Please, stop shouting.
More information about the Python-list
mailing list