Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: CMF

CMFCore.exportimport.properties import encoding

 

 

Zope cmf RSS feed   Index | Next | Previous | View Threaded


lafere at gmail

Jul 15, 2008, 6:17 AM

Post #1 of 3 (1069 views)
Permalink
CMFCore.exportimport.properties import encoding

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
_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


y.2008 at wcm-solutions

Jul 15, 2008, 11:08 AM

Post #2 of 3 (999 views)
Permalink
Re: CMFCore.exportimport.properties import encoding [In reply to]

Hi Ricardo!


Ricardo Alves wrote:
> 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:
> ...

I agree that _importNode() should fall back to this encoding if
default_charset is not specified in the import.

Please report the bug to https://bugs.launchpad.net/zope-cmf/ .

> 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...

Yes. This is a Plone issue.


Cheers,

Yuppie

_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


lafere at gmail

Jul 15, 2008, 4:11 PM

Post #3 of 3 (1005 views)
Permalink
Re: Re: CMFCore.exportimport.properties import encoding [In reply to]

yuppie wrote:
> Hi Ricardo!
>
>
> Ricardo Alves wrote:
>> 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:
>> ...
>
> I agree that _importNode() should fall back to this encoding if
> default_charset is not specified in the import.
>
> Please report the bug to https://bugs.launchpad.net/zope-cmf/ .

OK, reported: https://bugs.launchpad.net/zope-cmf/+bug/248853


Thanks,

Ricardo

_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests

Zope cmf RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.