我正在尝试以阿拉伯语创建 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;
}
}