[
https://issues.apache.org/jira/browse/WICKET-4460?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Martin Grigorov resolved WICKET-4460.
-------------------------------------
Resolution: Fixed
Fix Version/s: 6.0.0
1.5.6
Assignee: Martin Grigorov
Changed to .getBytes("UTF-8").
I'm also not aware of an easy way to detect the charset encoding of a text.
> Wrong string encoding in JavaScriptPackageResource
> --------------------------------------------------
>
> Key: WICKET-4460
> URL: https://issues.apache.org/jira/browse/WICKET-4460
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.5.5
> Environment: Wicket 1.5.5, Jetty 7.6.2, Windows
> Reporter: Jonas
> Assignee: Martin Grigorov
> Priority: Minor
> Fix For: 1.5.6, 6.0.0
>
>
> org.apache.wicket.request.resource.JavaScriptPackageResource.processResponse(Attributes,
> byte[])
> transforms javascript using an IJavaScriptCompressor if configured - which is
> the case by default in deployment mode, but not in development mode.
> The problem is that the code uses UTF-8 encoding when creating the String
> from bytes, but when converting the result String of IJavaScriptCompressor
> back to bytes, the platform's default encoding is used (e.g. Cp1252 on
> Windows).
> I propose to at least use the same character encoding while converting
> from/to bytes:
> something like (JavaScriptPackageResource line 59 and following):
> try
> {
> String nonCompressed = new
> String(processedResponse, "UTF-8");
> return
> compressor.compress(nonCompressed).getBytes("UTF-8");
> }
> catch (Exception e)
> {
> log.error("Error while filtering content", e);
> return processedResponse;
> }
> Of course it would be even better not to make any assumtions about the
> encoding of the .js file, but I'm not sure how one could determine that.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira