[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/presentation/zpt.py Made UTF-8 default encoding.

Stephan Richter srichter at cosmos.phy.tufts.edu
Fri Jul 9 11:45:19 EDT 2004


Log message for revision 26307:

Made UTF-8 default encoding.




-=-
Modified: Zope3/trunk/src/zope/app/presentation/zpt.py
===================================================================
--- Zope3/trunk/src/zope/app/presentation/zpt.py	2004-07-09 15:45:17 UTC (rev 26306)
+++ Zope3/trunk/src/zope/app/presentation/zpt.py	2004-07-09 15:45:19 UTC (rev 26307)
@@ -171,8 +171,8 @@
     def setBody(self, data):
         # Convert the data to Unicode, since that's what ZPTTemplate
         # wants; it's normally read from a file so it'll be bytes.
-        # XXX This will die if it's not ASCII.  Guess encoding???
-        self.context.source = unicode(data)
+        # The default encoding in Zope is UTF-8.
+        self.context.source = data.decode('UTF-8')
 
     def extra(self):
         return AttrMapping(self.context, ('contentType', 'expand'))



More information about the Zope3-Checkins mailing list