I am sending to the browser a request to save a file with the file name.
The file name might include spaces, so i replace all spaces with %20.
Internet Explorer and Chrome transfers %20 back to spaces, but Firefox does not to that. why?
Is there a way make all browsers show the space?
This is my code:
String codedName = new String(URLEncoder.encode(name, "UTF-8"));
codedName = codedName.replaceAll("\\+", "%20");
response.setHeader("Content-Disposition", "attachment; filename=\"" + codedName+ "\"");
That depends on how you create the file name. Usually, you can simply set the file name in the header field and the framework will encode it properly. In your case, you seem to encode the name twice. Try without encoding it.