[Zope-CMF] CMFCore.exportimport.properties import encoding

Ricardo Alves lafere at gmail.com
Tue Jul 15 09:17:27 EDT 2008


Hi,

I'm having a problem with encoding of properties.xml, and I'm not sure 
if its an issue of CMFCore or Plone. Maybe it's not even an issue, but 
here it goes:

If the properties.xml file doesn't include any charset declaration, in 
CMFCore.exportimport.properties, _importNode relies on 
default-zpublisher-encoding (defined at zope.conf) and not in the 
context/site charset, like _exportNode does.

So, if we have default-zpublisher-encoding set to 'iso-8859-1' and the 
site charset is 'utf-8', property values will be stored encoded as 
'iso-8859-1'.

One possible fix, would be to get the context encoding in _importNode, 
just like _exportNode:

     ...
    
     def _importNode(self, node):
         """Import the object from the DOM node.
         """
+        self._encoding = self.context.getProperty('default_charset', 
'utf-8')
         for child in node.childNodes:
     ...


But there is another problem: even then, it wouldn't work for Plone. The 
'default_charset' property is only available at 
portal.portal_properties.site_properties, so 
context.getProperty('default_charset') will fail. But, I guess, this is 
a Plone problem...


Any thoughts?

Thanks for your attention,


Ricardo Alves


More information about the Zope-CMF mailing list