Re: IUnicodeEncodingConflictResolver moronosity

Hanno Schlichting <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <[email protected]>
On Tue, Sep 21, 2010 at 8:17 PM, Chris Withers <[email protected]> wrote:
> I like the idea of IUnicodeEncodingConflictResolver, ...

[...]

> Why has no-one noticed this?

Because there's not all that many people left using plain Zope 2 and
upgrading to new versions.

The rest is using Plone, which has its own version of this:

def _unicode_replace(structure):
    if isinstance(structure, str):
        text = structure.decode('utf-8', 'replace')
    else:
        text = unicode(structure)
    return text

class UTF8EncodingConflictResolver(object):
    implements(IUnicodeEncodingConflictResolver)

    def resolve(self, context, text, expression):
        return _unicode_replace(text)

We can do this, as we force manage_page_charset and
default-zpublisher-encoding to be utf-8 and only support utf-8 and
Unicode in the database.

Zope 2 itself tries to support arbitrary encodings, at which point it
can only guess badly or fail.

Hanno
_______________________________________________
Zope-Dev maillist  -  [email protected]
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 )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.