und wieder hab ich ein Problem

Ich habe eine html-Datei mit einem Formular das die Daten von 2 Eingabefeldern per "POST" in UTF-8 an mein cgi-script schickt. Das script soll diese Daten verarbeiten und dann wieder in einer anderen html-datei ausgeben, die auch in UTF-8 sein soll. Das Funktioniert auch. Trotzdem werden in der html-datei Umlaute wie z.b. aus einem "ü" noch ein "\xc3\xbc" usw. eben.
Hier mal das script:
Code: Alles auswählen
#! c:\Python25\Python.exe
# -*- coding: UTF-8 -*-
import datetime
from BeautifulSoup import BeautifulSoup, Tag
import cgi
import cgitb; cgitb.enable()
print "Content-Type: text/html"
print
form = cgi.FieldStorage()
autorname = form.getvalue("name", "")
autortext = form.getvalue("text", "")
#if autorname or autortext == None:
# print """alert("Bitte füllen sie alle Felder aus")"""
#else:
# pass
html_dat = open("c:/html_seite/vers_2/gaestebuch.html", "r")
html_str = html_dat.read()
html_dat.close
#html_utf = html_str.decode("utf8")
Datum = datetime.datetime.today()
Datum_str= Datum.strftime("%d.%m.%Y um %H:%M:%S Uhr")
soup = BeautifulSoup(html_str)
comment = """
<x> </x>
<tr bgcolor="#484848">
<td widht="50%" style="border-left-width:2px; border-top-width:2px; border-bottom-width:0px; border-right-width:0px; border-style:solid; border-color:#000000; ">
""", autorname,"""
</td>
<td width="50%" align="right" style="border-right-width:2px; border-top-width:2px; border-bottom-width:0px; border-left-width:0px; border-style:solid; border-color:#000000; ">
""", Datum_str,"""
</td>
</tr>
<tr>
<td colspan="2" bgcolor="#626262" style="border-width:2px; border-style:solid; border-color:#000000; ">
""", autortext,"""
</td>
</tr>
<tr height="25px">
</tr>"""
comment_string = str(comment)
soup.x.replaceWith(comment_string)
soup_string = str(soup)
soup_utf = soup_string.decode("utf8")
html_str.strip()
html_save = open("c:/html_seite/vers_2/gaestebuch.html", "w")
html_save.write(soup_utf.encode("utf-8"))
html_save.flush()
html_save.close
print """<meta http-equiv="refresh" content="0; URL=../gaestebuch.html">"""
print """<a href="../gaestebuch.html">zurück zum Gästebuch</a>"""
PS:Hoffe ihr verübelt mir nicht die vielen "extrem"-Anfänger-Fragen, aber ich bin nunmal einer
