You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (JIRA)" <ji...@apache.org> on 2018/09/14 07:57: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=16614488#comment-16614488 ]
Martin Grigorov commented on WICKET-6586:
-----------------------------------------
Out of curiosity: why one would want to maintain code base with mixed text encoding ?
If you have JS/CSS resources with different (more than 2) encodings then the developer will have to configure it for each and every JSRR/CssRR.
Isn't it better to keep all your static resources with the same encoding ? 99.9% of the time UTF-8 will cover you. If you do more fancy stuff then you may need UTF-16, but again: why ?
> 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
> 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)