Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-6012

Confused character encodings in JavaScriptPackageResource and CssPackageResource

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 6.20.0
    • None
    • wicket
    • None
    • Windows server
      Tomcat 7
      Wicket 6.20.0

    Description

      We encountered a character encoding problem with a Javascript resource provided by Wicket 6.20.0 from our application hosted by Tomcat 7 on a Windows server (with a JVM default charset of "windows-1252").

      The source Javascript resource is UTF-8 encoded with a leading BOM mark. The leading bytes of the resource received by the browser are broken.

      We tested several different solutions which all worked (with various consequences):

      1. Remove the BOM mark from the source Javascript file
      2. Set the JVM "file.encoding" property to "UTF-8".
      3. Disable DefaultJavaScriptCompressor in Wicket
      4. Change the code in JavaScriptPackageResource to "return output.getBytes("UTF-8")"

      We solved this problem using solution #1.

      We think you should consider changing the code in JavaScriptPackageResource and CssPackageResource per solution #4.

      Please see the attached images and an example quickstart test case (which demonstrates the problem on my Windows machine where the JVM default character encoding is "windows-1252").

      Thanks to the Wicket team for a great framework.

      Attachments

        1. JavaScriptPackageResource.jpg
          210 kB
          Jon Mann
        2. js-compressor-disabled.jpg
          125 kB
          Jon Mann
        3. js-compressor-enabled.jpg
          123 kB
          Jon Mann
        4. wicket-6012-test.zip
          9 kB
          Jon Mann

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Jon Mann Jon Mann
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: