[Zope-CMF] Re: [RFC] [Patch] GenericSetup and encodings

yuppie y.2006_ at wcm-solutions.de
Wed Jun 7 08:06:00 EDT 2006


Hi Yves!


Yves Bastide wrote:
> GenericSetup has problems handling non-ASCII data.

1.) GenericSetup explicitly doesn't support non-UTF-8 XML in profiles. 
UTF-8 is the default encoding for XML and I can't see a need to support 
other XML encodings.

2.) GenericSetup explicitly doesn't support non-UTF-8 site settings. If 
someone provides a good patch this feature can be added.

3.) GenericSetup is not tested with non-ASCII UTF-8 site settings. AFAIK 
import works, but not export. I consider this a bug.

> It treats strings 
> sometimes as ASCII, sometimes as UTF-8, yet it has access to two 
> variables: its own ISetupContext.getEncoding() (whose use I didn't fully 
> grok) and CMF's ISetupContext.getSite().getProperty('default_charset').

Sorry, but your assumptions are wrong:

- The default setup tool creates export contexts without specifying the 
encoding, so ISetupContext.getEncoding() returns always None. And even 
if it would be set it represents the encoding of the exported files, not 
the site encoding.

- getSite().getProperty('default_charset') is CMF specific and should 
not be used in GenericSetup.

- The adapters adapt ISetupEnviron, not ISetupContext. getEncoding() and 
getSite() are not always available.

> Attached is a patch using both of them and somewhat working in my setup. 
> Can knowledgeable people comment on it before I enter a collector issue? 
> (I'm using GS alongside with CPS, which also needs some patching; yet 
> basic things, such as exporting-importing an iso8859-15 Title in a CMF 
> charset-default'ed to iso8859-15, should work)

First of all we need unit tests that make sure UTF-8 works and I think 
this should be the default used by GenericSetup. Code that needs to know 
how to find the site encoding can't be generic.

There is an additional problem: If tools use the default property edit 
page from OFS the properties might have a different encoding than 
'default_charset' of the site. Since the default 
'management_page_charset' is UTF-8 we have less trouble if we allow only 
UTF-8.


Cheers,

	Yuppie




More information about the Zope-CMF mailing list