Log message for revision 41151:
    preferred ZPT encoding (for backward compatibility) can be defined as 
$ZPT_PREFERRED_ENCODING
  

Changed:
  U   
Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/ZopePageTemplate.py

-=-
Modified: 
Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/ZopePageTemplate.py
===================================================================
--- 
Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/ZopePageTemplate.py
   2006-01-05 15:32:33 UTC (rev 41150)
+++ 
Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/ZopePageTemplate.py
   2006-01-05 15:53:38 UTC (rev 41151)
@@ -41,6 +41,9 @@
 # regular expression to extract the encoding from the XML preamble
 encoding_reg= re.compile('<\?xml.*?encoding="(.*?)".*?\?>', re.M)
 
+preferred_encodings = ['utf-8', 'iso-8859-15']
+if os.environ.has_key('ZPT_PREFERRED_ENCODING'):
+    preferred_encodings.insert(0, os.environ['ZPT_PREFERRED_ENCODING'])
 
 class SecureModuleImporter:
     __allow_access_to_unprotected_subobjects__ = 1
@@ -372,7 +375,7 @@
         if not isinstance(text, unicode):
 
             # ATT: the encoding guessing should be made more flexible
-            for encoding in ('iso-8859-15', 'utf-8'):
+            for encoding in preferred_encodings:
                 try:
                     state['_text'] = unicode(text, encoding)
                     self.__dict__.update(state)

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to