[Zope3-checkins] CVS: Zope3/src/zope/publisher - http.py:1.32

Stephan Richter srichter at cosmos.phy.tufts.edu
Thu Aug 7 21:18:44 EDT 2003


Update of /cvs-repository/Zope3/src/zope/publisher
In directory cvs.zope.org:/tmp/cvs-serv26232/publisher

Modified Files:
	http.py 
Log Message:
Oy, another annoying bug I hit. For some reason my Mozilla did not send a
Character Encoding, so that request._charset was None, which caused the 
server not to do the encoding. This should **never** happend. 

I changed it so that UTF-8 is used, so that the server does not crash. Or 
should we create yet another error screen.


=== Zope3/src/zope/publisher/http.py 1.31 => 1.32 ===
--- Zope3/src/zope/publisher/http.py:1.31	Wed Jul 30 11:06:53 2003
+++ Zope3/src/zope/publisher/http.py	Thu Aug  7 20:18:39 2003
@@ -975,8 +975,11 @@
 
 
     def _encode(self, text):
-        if self._charset is not None and isinstance(text, unicode):
-            return text.encode(self._charset)
+        # We **always** have to convert unicode to ASCII. If no character set
+        # is found, we just use unicode. That is still better than our server
+        # crashing.
+        if isinstance(text, unicode):
+            return text.encode(self._charset or 'UTF-8')
         return text
 
 




More information about the Zope3-Checkins mailing list