Tapestry
  1. Tapestry
  2. TAPESTRY-1591

Encoding for Ajax Request is always UTF-8

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.1.2
    • Fix Version/s: 4.1.2
    • Component/s: None
    • Labels:
      None

      Description

      Ajax request encoding should match template content type.

      It should follow:

      org.apache.tapestry.output-encoding

        Activity

        Hide
        Lionel Touati added a comment -

        In the form.js file, in method submitAsync, the arguments passed to the binding method of dojo use the following arguments:

        var kwArgs={
        formNode:form,
        content:content,
        useCache:true,
        preventCache:true,
        error: (function()

        {tapestry.error.apply(this, arguments);}),
        encoding: "UTF-8"
        };

        My problem is that the rest of the application is rendered with another encoding. So when the data is posted to the server, a conversion occurs, with misinterpret the data. By changing to

        var kwArgs={
        formNode:form,
        content:content,
        useCache:true,
        preventCache:true,
        error: (function(){tapestry.error.apply(this, arguments);}

        ),
        encoding: "ISO-8859-1"
        };

        My problem is gone, as ISO-8859-1 is the encoding I use.

        The is the same issue in the bind method of the core.js file

        To reproduce the issue, put org.apache.tapestry.output-encoding as 8859-1 and enter the following character é

        the has not the same position in the 2 charsets. When the data is submitted using ajax to the server, the data will be wrongly converted

        Hope this helps

        Show
        Lionel Touati added a comment - In the form.js file, in method submitAsync, the arguments passed to the binding method of dojo use the following arguments: var kwArgs={ formNode:form, content:content, useCache:true, preventCache:true, error: (function() {tapestry.error.apply(this, arguments);}), encoding: "UTF-8" }; My problem is that the rest of the application is rendered with another encoding. So when the data is posted to the server, a conversion occurs, with misinterpret the data. By changing to var kwArgs={ formNode:form, content:content, useCache:true, preventCache:true, error: (function(){tapestry.error.apply(this, arguments);} ), encoding: "ISO-8859-1" }; My problem is gone, as ISO-8859-1 is the encoding I use. The is the same issue in the bind method of the core.js file To reproduce the issue, put org.apache.tapestry.output-encoding as 8859-1 and enter the following character é the has not the same position in the 2 charsets. When the data is submitted using ajax to the server, the data will be wrongly converted Hope this helps
        Hide
        Jesse Kuhnert added a comment -

        I've looked in to this and am not sure it's what you expect. By default right now this parameter gets passed in to the dojo IO functions which use the native browser encodeURIComponent for utf encoding of client side data and some manual string process for any others.

        Are you sure the problem is the request data going back to the server or is it the response coming from the server? Is there some sample text I can use to see this myself?

        Show
        Jesse Kuhnert added a comment - I've looked in to this and am not sure it's what you expect. By default right now this parameter gets passed in to the dojo IO functions which use the native browser encodeURIComponent for utf encoding of client side data and some manual string process for any others. Are you sure the problem is the request data going back to the server or is it the response coming from the server? Is there some sample text I can use to see this myself?

          People

          • Assignee:
            Jesse Kuhnert
            Reporter:
            Lionel Touati
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development