I have GWT app from where I can download some files. And I've got a problem with encoding.
Here is some code:
String n = "Żółw testuje ąśżźć !#$%~ du";
String tmp = new String();
for(int i = 0; i < n.length(); i++) {
String t = Character.toString(n.charAt(i));
if(" =-_]}[{)(&^%$#@!~`,".contains(t))
tmp +=t;
else
tmp += URLEncoder.encode(t, "UTF-8");
}
response.setHeader("Content-Disposition", "attachment; filename=\"" + tmp +"\"");
System.out.println(tmp);
In Chrome and IE the filename is "Żółw testuje ąśżźć !#$%~ du" but in Firefox is "%C5%BB%C3%B3%C5%82w testuje %C4%85%C5%9B%C5%BC%C5%BA%C4%87 !#$%~ du". I already tested with Windows-1252, ISO-8859-1, Cp852 and with "attachment; filename*=utf-8''" but no good.
Any suggestions?