[Zope3-dev] Re: zope.tal.xmlparser.XMLParser() dislikes unicode

Martijn Faassen faassen at startifact.com
Mon Jan 15 09:44:01 EST 2007


Hey,

On 1/15/07, Andreas Jung <lists at zopyx.com> wrote:
[snip]
> ok, got it. But this problem can be solved easily by changing the encoding
> within the preamble.

I would say refusing to guess and bailing out with an error message is
better in this case. The Zen of Python:

In the face of ambiguity, refuse the temptation to guess.

applies very much in this case in my opinion. Changing the preamble is
too much like "do what I mean" to me - do we really know the developer
actually had any clue what they were doing when they somehow created
this unicode string with an encoding declaration? I'm not even sure I
know what it *means* to have a unicode serialized XML string with an
encoding declaration.

I already think we have code in lxml we can look at to base refusal to guess on.

Regards,

Martijn


More information about the Zope3-dev mailing list