You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Per Östlund (JIRA)" <ji...@apache.org> on 2015/07/08 13:23:04 UTC

[jira] [Commented] (WICKET-4460) Wrong string encoding in JavaScriptPackageResource

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

Per Östlund commented on WICKET-4460:
-------------------------------------

After the fix in https://issues.apache.org/jira/browse/WICKET-5827 this issue is back again.

> 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-beta1
>
>
> 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 was sent by Atlassian JIRA
(v6.3.4#6332)