1

When i download the file (pdf/xls/text) file from portal, the file name is not showing properly in IE and working fine in other browsers

if(((String) requestKeys.getSessionAttribute(EnumParameterNames.USER_AGENT)).contains("MSIE")){
    fileName = URLEncoder.encode(fileName, "UTF-8"); // it results filename mL_úPDF_20150210185915.pdf  
} else {
    fileName = "=?UTF-8?B?" + new String(Base64.encodeBase64(fileName.getBytes("UTF-8")), "UTF-8") + "?="; // working fine for all browsers 
}

I have used Content-Disposition also and but getting same error

response.setHeader("Content-Disposition","attachment; filename="+fileName);

please suggest and thanks for the help!

WeSt
  • 2,628
  • 5
  • 22
  • 37
user3714194
  • 29
  • 1
  • 3
  • [Don't support IE](https://paydirtapp.com/blog/we-dont-support-ie/) – m0skit0 Feb 11 '15 at 11:55
  • you problem is IE and you file encoding. –  Feb 11 '15 at 11:58
  • I think m0skit0 is correct on this one. Even if it was not IE it is a bad practice to alter your code just to satisfy the needs of a single one. UTF-8 supports Japanese unless some pretty exotic characters don't show up. If one sticks to the "basics" UTF-16 is used as a fixed length UTF-8-like encoding in such cases. Btw when posting such questions relating to a specific software product one should not forget to mention which version is used! Also see this answer: http://stackoverflow.com/a/4655335/1559401 – rbaleksandar Feb 11 '15 at 12:02
  • I am using java 1.6v and WAS server – user3714194 Feb 11 '15 at 12:21

1 Answers1

0

Try using UTF-16LE encoding instead of UTF-8. This should resolve your issue.

  • Hi Rahul, i have tried with UTF-16LE but not resolved my issue. – user3714194 Feb 11 '15 at 12:27
  • Hi user3714194, since this is happening only on IE, u can try uninstalling and then re-installing the Japanese language pack from control panel>region and language. – rahul13579 Feb 11 '15 at 13:51