Index: pykota/trunk/cgi-bin/printquota.cgi
===================================================================
--- pykota/trunk/cgi-bin/printquota.cgi (revision 3275)
+++ pykota/trunk/cgi-bin/printquota.cgi (revision 3295)
@@ -31,8 +31,10 @@
 from mx import DateTime
 
-from pykota import version
-from pykota.tool import PyKotaTool, PyKotaToolError
-from pykota.reporter import PyKotaReporterError, openReporter
-from pykota.cgifuncs import getLanguagePreference, getCharsetPreference
+import pykota.appinit
+
+from pykota import version, utils
+from pykota.tool import PyKotaTool
+from pykota.errors import PyKotaToolError, PyKotaReporterError
+from pykota.reporter import openReporter
 
 header = """Content-type: text/html;charset=%s
@@ -44,5 +46,4 @@
   </head>
   <body>
-    <!-- %s %s -->
     <p>
       <form action="printquota.cgi" method="POST">
@@ -96,13 +97,15 @@
         """Displays the administrative interface."""
         global header, footer
-        print header % (self.charset, _("PyKota Reports"), \
-                        self.language, self.charset, \
-                        self.config.getLogoLink(), \
-                        self.config.getLogoURL(), version.__version__, \
-                        self.config.getLogoLink(), \
-                        version.__version__, _("PyKota Reports"), \
-                        _("Report"))
-        print self.body
-        print footer % (_("Report"), version.__doc__, version.__years__, version.__author__, version.__gplblurb__)
+        content = [ header % (self.charset, _("PyKota Reports"), \
+                              self.config.getLogoLink(), \
+                              self.config.getLogoURL(), version.__version__, \
+                              self.config.getLogoLink(), \
+                              version.__version__, _("PyKota Reports"), \
+                              _("Report")) ]
+        content.append(self.body)                      
+        content.append(footer % (_("Report"), version.__doc__, version.__years__, version.__author__, version.__gplblurb__))
+        for c in content :
+            sys.stdout.write(c.encode(self.charset, "replace"))
+        sys.stdout.flush()
         
     def error(self, message) :
@@ -287,5 +290,6 @@
             
 if __name__ == "__main__" :
-    admin = PyKotaReportGUI(lang=getLanguagePreference(), charset=getCharsetPreference())
+    utils.reinitcgilocale()
+    admin = PyKotaReportGUI()
     admin.deferredInit()
     admin.form = cgi.FieldStorage()
Index: pykota/trunk/cgi-bin/pykotme.cgi
===================================================================
--- pykota/trunk/cgi-bin/pykotme.cgi (revision 3275)
+++ pykota/trunk/cgi-bin/pykotme.cgi (revision 3295)
@@ -30,7 +30,10 @@
 import cStringIO
 
-from pykota import version
-from pykota.tool import PyKotaTool, PyKotaToolError
-from pykota.cgifuncs import getLanguagePreference, getCharsetPreference
+import pykota.appinit
+
+from pykota import version, utils
+from pykota.tool import PyKotaTool
+from pykota.errors import PyKotaToolError
+
 from pkpgpdls import analyzer, pdlparser
     
@@ -44,5 +47,4 @@
   </head>
   <body>
-    <!-- %s %s -->
     <p>
       <form action="pykotme.cgi" method="POST" enctype="multipart/form-data">
@@ -96,13 +98,15 @@
         """Displays the administrative interface."""
         global header, footer
-        print header % (self.charset, _("PyKota Quotes"), \
-                        self.language, self.charset, \
+        content = [ header % (self.charset, _("PyKota Quotes"), \
                         self.config.getLogoLink(), \
                         self.config.getLogoURL(), version.__version__, \
                         self.config.getLogoLink(), \
                         version.__version__, _("PyKota Quotes"), \
-                        _("Quote"))
-        print self.body
-        print footer % (_("Quote"), version.__doc__, version.__years__, version.__author__, version.__gplblurb__)
+                        _("Quote")) ]
+        content.append(self.body)
+        content.append(footer % (_("Quote"), version.__doc__, version.__years__, version.__author__, version.__gplblurb__))
+        for c in content :
+            sys.stdout.write(c.encode(self.charset, "replace"))
+        sys.stdout.flush()
         
     def error(self, message) :
@@ -187,5 +191,6 @@
             
 if __name__ == "__main__" :
-    admin = PyKotMeGUI(lang=getLanguagePreference(), charset=getCharsetPreference())
+    utils.reinitcgilocale()
+    admin = PyKotMeGUI()
     admin.deferredInit()
     admin.form = cgi.FieldStorage()
Index: pykota/trunk/cgi-bin/dumpykota.cgi
===================================================================
--- pykota/trunk/cgi-bin/dumpykota.cgi (revision 3275)
+++ pykota/trunk/cgi-bin/dumpykota.cgi (revision 3295)
@@ -29,8 +29,7 @@
 import urllib
 
-from pykota import version
-from pykota.tool import PyKotaToolError
+import pykota.appinit
+from pykota import version, utils
 from pykota.dumper import DumPyKota
-from pykota.cgifuncs import getLanguagePreference, getCharsetPreference
 
 header = """Content-type: text/html;charset=%s
@@ -68,5 +67,4 @@
   </head>
   <body>
-    <!-- %s %s -->
     <p>
       <form action="dumpykota.cgi" method="GET" name="mainform" onsubmit="return checkvalues()">
@@ -123,21 +121,23 @@
         """Displays the dumper interface."""
         global header, footer
-        print header % (self.charset, _("PyKota Data Dumper"), \
-                        self.language, self.charset, \
+        content = [ header % (self.charset, _("PyKota Data Dumper"), \
                         self.config.getLogoLink(), \
                         self.config.getLogoURL(), version.__version__, \
                         self.config.getLogoLink(), \
                         version.__version__, _("PyKota Data Dumper"), \
-                        _("Dump"), _("Please click on the above button"))
-        print self.htmlListDataTypes(self.options.get("data", "")) 
-        print "<br />"
-        print self.htmlListFormats(self.options.get("format", ""))
-        print "<br />"
-        print self.htmlFilterInput(" ".join(self.arguments))
-        print "<br />"
-        print self.htmlOrderbyInput(self.options.get("orderby", ""))
-        print "<br />"
-        print self.htmlSumCheckbox(self.options.get("sum", ""))
-        print footer % (_("Dump"), version.__doc__, version.__years__, version.__author__, version.__gplblurb__)
+                        _("Dump"), _("Please click on the above button")) ]
+        content.append(self.htmlListDataTypes(self.options.get("data", "")))
+        content.append(u"<br />")
+        content.append(self.htmlListFormats(self.options.get("format", "")))
+        content.append(u"<br />")
+        content.append(self.htmlFilterInput(" ".join(self.arguments)))
+        content.append(u"<br />")
+        content.append(self.htmlOrderbyInput(self.options.get("orderby", "")))
+        content.append(u"<br />")
+        content.append(self.htmlSumCheckbox(self.options.get("sum", "")))
+        content.append(footer % (_("Dump"), version.__doc__, version.__years__, version.__author__, version.__gplblurb__))
+        for c in content :
+            sys.stdout.write(c.encode(self.charset, "replace"))
+        sys.stdout.flush()
         
     def htmlListDataTypes(self, selected="") :    
@@ -236,5 +236,6 @@
             
 if __name__ == "__main__" :
-    admin = PyKotaDumperGUI(lang=getLanguagePreference(), charset=getCharsetPreference())
+    utils.reinitcgilocale()
+    admin = PyKotaDumperGUI()
     admin.deferredInit()
     admin.form = cgi.FieldStorage()
