write html-headers (utf-8)

db duikboot at localhost.localdomain
Mon May 30 03:11:55 EDT 2005


Hello all,

I hope this is the correct newsgroup for this question.

Does anybody know how I can write a html-header with python(cgi)? 
The problem is, I have a few html templates in which I have a header e.g:

<!DOCTYPE  HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

In this template I write a few Mysql variables. 
Those variable often have german characters. This characters (Gösing in
stead of Gösing). The german characters in the html template are shown
correctly.

If I change the character encoding with the browser to utf-8, all the characters are shown correctly. 
As you can see, I put in the header of the html template that the encoding
is UTF-8, the browser still shows windows ISO-8859-15. Can I write the
header with python so the browser uses the utf-8 encoding?

My hosting providor uses fedora core 2, Python 2.2.3, MySQLdb. Mysql 3.23.58

I googled for hours, but I can't find the answer. I hope ypu can help me.

Thanks in advance.

Arjen




More information about the Python-list mailing list