On Wed, Sep 22, 2010 at 09:34:59AM +0100, Chris Withers wrote:
> On 22/09/2010 03:50, Andreas Jung wrote:
> > I also strongly object such a change in the default behavior.
> 
> I'm sorry, but WHAT?
> 
> > I did a
> > lot of testing of the current implementation and configuration with
> > various browsers and Zope applications and add-ons in order to make the
> > Zope 3 ZPT engine in Zope 2 work out-of-the-box for most applications.

Did "various browsers" include Safari and MSIE, I wonder?  Because those
are the ones causing me pain and UnicodeDecodeErrors.

> A less insane version of that default would be:
> 
> class BasicEncodingConflictResolver(object):
>        implements(IUnicodeEncodingConflictResolver)
> 
>        def resolve(self, context, text, expression):
>            logging.warn('You should register an '
>                         'IUnicodeEncodingConflictResolver that matches '
>                         'your content')
>            encodings = ['utf-8','latin-1']
>            mpc =  getattr(context,'management_page_charset',None)
>            if mpc:
>                encodings.insert(0,mpc)
>            for enc in encodings:
>                try:
>                    return unicode(text,enc)
>                except UnicodeDecorError:
>                    pass
>            return unicode(text,sys.getdefaultencoding(),'replace')

I would prefer this to current implementation.

Marius Gedminas
-- 
http://pov.lt/ -- Zope 3/BlueBream consulting and development

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )

Reply via email to