From dev-return-101065-apmail-cocoon-dev-archive=cocoon.apache.org@cocoon.apache.org Wed Jan 21 15:08:28 2009 Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 48316 invoked from network); 21 Jan 2009 15:08:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 Jan 2009 15:08:28 -0000 Received: (qmail 2919 invoked by uid 500); 21 Jan 2009 15:08:27 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 2780 invoked by uid 500); 21 Jan 2009 15:08:26 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@cocoon.apache.org List-Id: Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 2771 invoked by uid 99); 21 Jan 2009 15:08:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Jan 2009 07:08:26 -0800 X-ASF-Spam-Status: No, hits=-1999.8 required=10.0 tests=ALL_TRUSTED,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Jan 2009 15:08:19 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id B308C234C48B for ; Wed, 21 Jan 2009 07:07:59 -0800 (PST) Message-ID: <405552462.1232550479717.JavaMail.jira@brutus> Date: Wed, 21 Jan 2009 07:07:59 -0800 (PST) From: "Andreas Hartmann (JIRA)" To: dev@cocoon.apache.org Subject: [jira] Updated: (COCOON-2249) XHTMLSerializer uses entity references " and ' which cause JavaScript parse errors In-Reply-To: <1556485994.1232550120956.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/COCOON-2249?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] 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]. [1] http://www.w3.org/International/tutorials/tutorial-char-enc/#Slide0440 > XHTMLSerializer uses entity references " and ' which cause JavaScript parse errors > -------------------------------------------------------------------------------------------- > > Key: COCOON-2249 > URL: https://issues.apache.org/jira/browse/COCOON-2249 > 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 " 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. > true|false > [1] http://www.nabble.com/Problem-with-XHTMLSerializers-to1311360.html#a1311360 > [2] http://www.w3.org/International/tutorials/tutorial-char-enc/ -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.