Struts 2
  1. Struts 2
  2. WW-3824

Ajax request encoding case is different than non-ajax encoding

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 2.3.3
    • Fix Version/s: 2.3.7
    • Component/s: Dispatch Filter
    • Labels:
      None
    • Flags:
      Patch

      Description

      This is related to WW-3796: Error at setting character encoding if the parameters have been already read.
      For all non-ajax requests, the default encoding is "UTF-8", defined in struts.properties: struts.i18n.encoding
      For all ajax requests, the encoding is forced to "utf-8", defined in Dispatcher.java, line 684.
      Note that the first is upper-case, the other is lower-case.
      In the applyEncoding method, the encoding is compared case sensitive, so UTF-8 and utf-8 are not equal.
      The patch changes utf-8 to UTF-8. The reference in the source comment at that line: http://www.w3.org/TR/XMLHttpRequest/#the-send-method says: "Let encoding be UTF-8."
      This way the applyEncoding method will function as one would expect.

      1. WW-3824.diff
        0.6 kB
        Pelladi Gabor

        Activity

        Pelladi Gabor created issue -
        Pelladi Gabor made changes -
        Field Original Value New Value
        Attachment WW-3824.diff [ 12528592 ]
        Lukasz Lenart made changes -
        Fix Version/s 2.3.5 [ 12321274 ]
        Lukasz Lenart committed 1344134 (1 file)
        Reviews: none

        WW-3824 changes encoding definition to uppercase for Ajax requests to match specification

        Hide
        Lukasz Lenart added a comment -

        Patch applied, thanks for reporting!

        Show
        Lukasz Lenart added a comment - Patch applied, thanks for reporting!
        Lukasz Lenart made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Lukasz Lenart [ lukaszlenart ]
        Resolution Fixed [ 1 ]
        Hide
        Hudson added a comment -

        Integrated in Struts2 #482 (See https://builds.apache.org/job/Struts2/482/)
        WW-3824 changes encoding definition to uppercase for Ajax requests to match specification (Revision 1344134)

        Result = UNSTABLE
        lukaszlenart :
        Files :

        • /struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
        Show
        Hudson added a comment - Integrated in Struts2 #482 (See https://builds.apache.org/job/Struts2/482/ ) WW-3824 changes encoding definition to uppercase for Ajax requests to match specification (Revision 1344134) Result = UNSTABLE lukaszlenart : Files : /struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
        Hide
        Lukasz Lenart added a comment -

        ech.. "Finished: SUCCESS" but reports as unstable

        Show
        Lukasz Lenart added a comment - ech.. "Finished: SUCCESS" but reports as unstable
        Lukasz Lenart committed 1344143 (1 file)
        Reviews: none

        WW-3824 changes encoding definition to uppercase for Ajax requests to match specification

        Hide
        Hudson added a comment -

        Integrated in Struts2 #483 (See https://builds.apache.org/job/Struts2/483/)
        WW-3824 changes encoding definition to uppercase for Ajax requests to match specification (Revision 1344143)

        Result = SUCCESS
        lukaszlenart :
        Files :

        • /struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java
        Show
        Hudson added a comment - Integrated in Struts2 #483 (See https://builds.apache.org/job/Struts2/483/ ) WW-3824 changes encoding definition to uppercase for Ajax requests to match specification (Revision 1344143) Result = SUCCESS lukaszlenart : Files : /struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java
        Lukasz Lenart made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Lukasz Lenart made changes -
        Fix Version/s 2.3.6 [ 12323249 ]
        Fix Version/s 2.3.5 [ 12321274 ]
        Lukasz Lenart made changes -
        Fix Version/s 2.3.7 [ 12323448 ]
        Fix Version/s 2.3.6 [ 12323249 ]

          People

          • Assignee:
            Lukasz Lenart
            Reporter:
            Pelladi Gabor
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development