I am trying to generate reports in different languages like French, Spanish, etc. The report is being viewed using MS Excel 2007, It displays OK in English but not in French nor in Spanish when executed in Linux environment.
All languages works in Windows Server but when running it in Linux, I am experiencing the problem I described above.
The code is in Java and, I started like this:
String contentType = "text/csv; charset=utf-8";
// resp is HttpServletResponse
resp.setCharacterEncoding("utf-8");
resp.setHeader("Cache-Control", "max-age=0,must-revalidate");
resp.setHeader("Pragma", "cache");
resp.setDateHeader("Last-Modified", System.currentTimeMillis());
resp.setHeader("Content-disposition", "attachment; filename=\"Report.csv\"");
resp.setContentType(contentType);
OutputStream os = resp.getOutputStream();
os.write(new byte[] { (byte)0xEF, (byte)0xBB, (byte)0xBF });
//os.print("\uFEFF".getBytes()); <<- tried this too, did not worked!
//where sb is StringBuffer sb = new StringBuffer();
//and string values were added by sb.append("\"" + someString + "\",");
os.write(sb.toString().getBytes());
Please help and thank you in advance.