cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Hartmann (JIRA)" <>
Subject [jira] Updated: (COCOON-2249) XHTMLSerializer uses entity references &quot; and &apos; which cause JavaScript parse errors
Date Wed, 21 Jan 2009 15:07:59 GMT


Andreas Hartmann updated COCOON-2249:

    Attachment: COCOON-2249-2009-01-21-1601.txt

The patch enables subclasses of the EncodingSerializer to determine the encoder type after
the constructor has been called.

To resolve the escaping issue, a MinimalXMLEncoder has been introduced, which escapes only
the characters < > &, as recommended by the W3C for XHTML documents [1].


> XHTMLSerializer uses entity references &quot; and &apos; which cause JavaScript
parse errors
> --------------------------------------------------------------------------------------------
>                 Key: COCOON-2249
>                 URL:
>             Project: Cocoon
>          Issue Type: Improvement
>          Components: Blocks: Serializers
>    Affects Versions: 2.1.12-dev (Current SVN), 2.2-dev (Current SVN)
>            Reporter: Andreas Hartmann
>         Attachments: COCOON-2249-2009-01-21-1601.txt
> 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.
> Maybe we could make this behaviour configurable, e.g.
>   <use-entity-references>true|false</use-entity-references>
> [1]
> [2]

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message