我想用阿拉伯语创建CSV文件列,我正在使用资源包从属性文件中获取值,并且能够在阿拉伯文中获得值,但创建文件后列名显示为“?? ???????????”而不是阿拉伯语。请帮我解决这个问题。如何用阿拉伯语创建csv文件?
我使用下面的代码:
public static void downloadCSVForReconcilationData(String downloadStr,HttpServletResponse response,String reportName) throws IOException{
//response.setHeader("Content-Disposition", "inline;filename=\""+"BillingTrxReport.csv"+"\"");
response.setContentType ("application/x-csv");
response.setHeader("Content-Disposition","attachment; filename=\""+reportName+".csv"+"\";");
//response.setHeader("application/vnd.ms-excel;charset=Cp1256","attachment; filename=\""+reportName+".csv"+"\";");// khushwant Patidar
response.setContentType("application/vnd.ms-excel;charset=Cp1256");// khushwant Patidar
response.setContentLength((int) downloadStr.length());
try{
OutputStream out = response.getOutputStream();
PrintWriter pw = new PrintWriter(out);
BufferedWriter bufw=new BufferedWriter(pw);
//BufferedOutputStream outBuf = new BufferedOutputStream(out);
bufw.write(downloadStr);
bufw.close();
pw.close();
out.flush();
out.close();
}catch(IOException ioe){
ioe.printStackTrace();
throw ioe;
}
}
请张贴您的代码。 – logoff
该文件正确enconaded但阿拉伯语言不显示... –