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

ASF subversion and git services commented on WICKET-6586:
---------------------------------------------------------

Commit b1d099db857d007cc44a93317575304cee14b429 in wicket's branch 
refs/heads/wicket-8.x from Martin Tzvetanov Grigorov
[ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=b1d099d ]

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.

(cherry picked from commit 072b2fc7fd521ec07e40fc5af16b75db47694b33)


> 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)

Reply via email to