Tapestry 5
  1. Tapestry 5
  2. TAP5-714

Incorrect encoding of single quotes for Ajax requests

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 5.1.0.5
    • Fix Version/s: 5.2.0, 5.1.0.6, 5.1.0.7
    • Component/s: tapestry-core
    • Labels:
      None

      Description

      I've encountered what I think is a bug in the rendering of an ajax response.
      Basically, we're returning a block that contains a textfield component. The
      value of that textfield component is something with a single quote in it,
      for example "o'reilly". The response markup for that textfield is:

      <input value='o'reilly' id='addressLine1-1215dd60f22'
      name='addressLine1' type='text'><\/input>

      which renders as "o'reilly" in Firefox, but in IE the value renders as
      "o'reilly". According to
      http://cssvault.com/blog/2007/10/17/internet-explorer-apos-feature/ , it
      should be rendering out ' instead.

      I've looked into where the ' is coming from and its in the
      AbstractMarkupModel class, in the encodeQuoted() method (around line 132).

      1. TAP-714.patch
        1 kB
        Ciaran Wood
      2. TAP5-714-5.1.txt
        1 kB
        Ulrich Stärk

        Activity

        Hide
        Ciaran Wood added a comment -

        Added patch for 5.1.0.5 release tag source

        Show
        Ciaran Wood added a comment - Added patch for 5.1.0.5 release tag source
        Hide
        Ulrich Stärk added a comment -

        This is not only a problem with ajax requests but also when some text containing a single quote is to be edited in a textfield or a textarea. Even if the doctype is set to HTML4 (which does not contain the ' entity) Tapestry renders single quotes as ' thus failing to display single quotes correctly for users using IE7.

        Show
        Ulrich Stärk added a comment - This is not only a problem with ajax requests but also when some text containing a single quote is to be edited in a textfield or a textarea. Even if the doctype is set to HTML4 (which does not contain the ' entity) Tapestry renders single quotes as ' thus failing to display single quotes correctly for users using IE7.
        Hide
        David Rees added a comment -

        This is affecting IE6-IE8. It's a show-stopper! Can we get the priority raised of this one?

        Show
        David Rees added a comment - This is affecting IE6-IE8. It's a show-stopper! Can we get the priority raised of this one?
        Hide
        Thiago H. de Paula Figueiredo added a comment -

        Patch applied and committed. Thanks Ciaran Wood!

        Show
        Thiago H. de Paula Figueiredo added a comment - Patch applied and committed. Thanks Ciaran Wood!
        Hide
        David Rees added a comment -

        Can this also be applied to the 5.1.0.x-dev branch? Looks like the 5.1-dev branch is dead now that 5.2 will be the next major rev.

        Show
        David Rees added a comment - Can this also be applied to the 5.1.0.x-dev branch? Looks like the 5.1-dev branch is dead now that 5.2 will be the next major rev.
        Hide
        Ulrich Stärk added a comment -

        5.1 is not dead. Actually there is a discussion going on right now which bugs should be ported to the 5.1 branch for an upcoming 5.1.0.6 release

        Show
        Ulrich Stärk added a comment - 5.1 is not dead. Actually there is a discussion going on right now which bugs should be ported to the 5.1 branch for an upcoming 5.1.0.6 release
        Hide
        Ulrich Stärk added a comment -

        patch against 5.1 branch

        Show
        Ulrich Stärk added a comment - patch against 5.1 branch
        Hide
        Michael Wyraz added a comment -

        On Typestry 5.1.0.5 this can be easily fixed by creating a module which overrides the Service "MarkupWriterFactory":

        /**

        MarkupWriterFactoryImplBugfix is a copy of MarkupWriterFactoryImpl that uses "DefaultMarkupModelBugfix" and "XMLMarkupModelBugfix". These both are copies of "XMLMarkupModel" and "XMLMarkupModel" which extends "AbstractMarkupModelBugfix".
        AbstractMarkupModelBugfix extends AbstractMarkupModel and have a copy of method "encodeQuoted(String content, StringBuilder builder)" with the patch below applied.

        Since most things in these classes are final or private, everything has to be copied

        Show
        Michael Wyraz added a comment - On Typestry 5.1.0.5 this can be easily fixed by creating a module which overrides the Service "MarkupWriterFactory": /** Bugfixes for Tapestry 5.0.1.5 Bugs http://tapestry.apache.org/tapestry5/tapestry-ioc/cookbook/override.html - https://issues.apache.org/jira/browse/TAP5-714 Incorrect encoding of single quotes for Ajax requests */ public static void bind(ServiceBinder binder) { binder.bind(MarkupWriterFactory.class, MarkupWriterFactoryImplBugfix.class).withId("Override"); } @SuppressWarnings("rawtypes") public static void contributeServiceOverride(MappedConfiguration<Class,Object> configuration, @Local MarkupWriterFactory override) { configuration.add(MarkupWriterFactory.class, override); } MarkupWriterFactoryImplBugfix is a copy of MarkupWriterFactoryImpl that uses "DefaultMarkupModelBugfix" and "XMLMarkupModelBugfix". These both are copies of "XMLMarkupModel" and "XMLMarkupModel" which extends "AbstractMarkupModelBugfix". AbstractMarkupModelBugfix extends AbstractMarkupModel and have a copy of method "encodeQuoted(String content, StringBuilder builder)" with the patch below applied. Since most things in these classes are final or private, everything has to be copied

          People

          • Assignee:
            Thiago H. de Paula Figueiredo
            Reporter:
            Ciaran Wood
          • Votes:
            4 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development