Le 13/01/11 15:03, Hanno Schlichting a écrit :
> On Thu, Jan 13, 2011 at 2:17 PM, Godefroid Chapelle<got...@bubblenet.be>  
> wrote:
>> You make me wonder if I am actually reproducing something wrong in my
>> tests setup : am I allowed to set a unicode value in Title and Description ?
>
> I'm not sure what the Unicode story is like for CMF. I'd expect there
> to be no conversion at any level, so whatever you set via a mutator is
> also what you get from the accessor. That means there could be both
> Unicode or encoded strings in the encoding as stored in the properties
> tool.
>
> In Plone the situation is a different. If you have Archetypes you can
> pass in either utf-8 or Unicode into mutator methods, it will
> internally always store Unicode and the accessor will always return
> utf-8. But if you have Dexterity you will only set Unicode and get
> Unicode from objects. Strings encoded in a different encoding than
> utf-8 aren't supported since Plone 3.0 - so the site_encoding value is
> meaningless here.
>
> So any code that uses mutators or sets attributes should use Unicode.
> Any code that gets values from accessor or direct attributes needs to
> handle both Unicode and utf-8 in Plone - in CMF it should also handle
> the additional arbitrary encoding set as site_encoding (which could be
> latin-1).
>
> There's more rules like all the data in one catalog index has to be in
> the same encoding or be all Unicode (or you'll get errors inside the
> BTree logic trying to compare mixed types). In Plone we changed page
> templates to except both utf-8 and Unicode inside TAL constructs and
> convert them to Unicode for you. In CMF that doesn't happen, so you
> need to be consistent.
>
> Unicode transition fun :)
> Hanno

With this explanation, I understand the reminiscences that lead me to 
code revision 119650.

I reverted 119651 to avoid double encoding (as told soon by Wichert).

I would still appreciate review of

http://zope3.pov.lt/trac/changeset/119560/Products.CMFCore/branches/2.2

Thanks for reactions.

-- 
Godefroid Chapelle (aka __gotcha) http://bubblenet.be

_______________________________________________
Zope-CMF maillist  -  Zope-CMF@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests

Reply via email to