Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
1.5.5
-
None
-
Wicket 1.5.5, Jetty 7.6.2, Windows
Description
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.
Attachments
Issue Links
- is duplicated by
-
WICKET-5946 JavaScript/Css PackageResource should use the same charset for compressing
- Resolved