cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Hartmann <>
Subject Entity escaping in o.a.c.c.serializers.XHTMLSerializer
Date Wed, 21 Jan 2009 12:21:35 GMT
Hi Cocoon devs,

this issue has already been discussed several times, e.g. [1], but AFAIK 
has not been resolved yet.

The XHTMLSerializer, or, more specifically, the XHMLEncoder, from the 
serializers block in Cocoon 2.1.x escapes all characters with a 
corresponding HTML 4.0 character entity reference into this entity 
reference. This causes issues with inline JavaScript, since e.g. the 
double quotes are transformed to &quot; which causes a JavaScript 
parsing error. Another minor negative effect is the increased document size.

If I understand the W3C correctly, see e.g. [2], the recommended 
approach is to use the character set of the encoding as far as possible,
and use escapes only in exceptional circumstances. I didn't find a 
reason why the XHTMLSerializer uses escapes, but I suspect that it is 
related to browser compatibility issues.

Do you think it would make sense to make this behaviour configurable, e.g.


Does the XHTMLSerializer in Cocoon 2.2 show a different behaviour?

TIA for any comments!

-- Andreas


Andreas Hartmann, CTO
BeCompany GmbH
Tel.: +41 (0) 43 818 57 01

View raw message