You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/10/12 07:01:00 UTC

[jira] [Commented] (WICKET-6586) Broken JavaScript due to fix charsetName in JavaScriptPackageResource

    [ https://issues.apache.org/jira/browse/WICKET-6586?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16647552#comment-16647552 ] 

ASF GitHub Bot commented on WICKET-6586:
----------------------------------------

GitHub user martin-g opened a pull request:

    https://github.com/apache/wicket/pull/295

    WICKET-6586 Broken JavaScript due to fix charsetName in JavaScriptPac…

    …kageResource
    
    Introduce PackageResource#getProcessingEncoding() that could be overridden by the application to use a custom encoding to read a resource from the class path.
    Move the compressing logic from Css/JavaScript-PackageResource to PackageResource class to DRY it.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/apache/wicket WICKET-6586-introduce-processing-encoding

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/wicket/pull/295.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #295
    
----
commit 072b2fc7fd521ec07e40fc5af16b75db47694b33
Author: Martin Tzvetanov Grigorov <mg...@...>
Date:   2018-10-12T06:58:04Z

    WICKET-6586 Broken JavaScript due to fix charsetName in JavaScriptPackageResource
    
    Introduce PackageResource#getProcessingEncoding() that could be overridden by the application to use a custom encoding to read a resource from the class path.
    Move the compressing logic from Css/JavaScript-PackageResource to PackageResource class to DRY it.

----


> Broken JavaScript due to fix charsetName in JavaScriptPackageResource
> ---------------------------------------------------------------------
>
>                 Key: WICKET-6586
>                 URL: https://issues.apache.org/jira/browse/WICKET-6586
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 7.10.0
>            Reporter: Andreas Müller
>            Assignee: Martin Grigorov
>            Priority: Major
>
> 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:
> {code:java}
> @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";
> ...{code}
> 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()}}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)