JSP to Excel encoding problem. Value=?
Jsp page shows arabic character verywell as like this:
about something bla bla تضارب توقعات شهر أكتوبر فيق الـ و الـ
but when I export it to Excel and try to open it,Excel says:
The file you are trying to open 'example.xls' is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?
After clicking yes, value is which I wrote before is:
about something bla bla ??????????????????????????
Jsp page has:
<%@ page isELIgnored="false" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
if I copy arabic characters and paste it to Excel,Excel shows them clearly.
I use charset=cp1254. when I change it to charset=cp1256, Value is like freak characters.
any ideas to fix 开发者_JAVA技巧it?
You're fooling Excel by a plain vanilla HTML file with the wrong extension. This is not going to work flawlessly, as Excel has warned you.
You need to serve a real binary XLS file using a Servlet, not some HTML table using a JSP. You can use Apache POI HSSF or JExcelAPI for this.
精彩评论