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

Broken JavaScript due to fix charsetName in JavaScriptPackageResource

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 7.10.0
    • 7.11.0, 8.2.0, 9.0.0-M1
    • wicket
    • None

    Description

      When running Wicket in DEPLOYMENT Mode, DefaultJavaScriptCompressor will be set as JavaScript Compressor by default to strip Comments and Whitespaces from JavaScript files.

      In JavaScriptPackageResource the processResponse method sets the charsetName fix to "UTF-8", when compressing JS files:

      @Override
      protected byte[] processResponse(final Attributes attributes, byte[] bytes)
      {
       final byte[] processedResponse = super.processResponse(attributes, bytes);
      
       IJavaScriptCompressor compressor = getCompressor();
      
       if (compressor != null && getCompress())
       {
        try
        {
         String charsetName = "UTF-8";
      ...

      If those JavaScript files are not in UTF-8, the Compressor can break those files.

      E.g. when using ISO-8859-15 and having umlauts in the file, the umlauts will be replaced by the REPLACEMENT CHARACTER "\uefbfbd".

      There should be a way to specify the charsetName in JavaScriptPackageResource.

      E.g. by calling something like getResourceSettings().setJavaScriptCharset()

      Attachments

        Activity

          People

            mgrigorov Martin Tzvetanov Grigorov
            skyYaga Andreas Müller
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: