when the string u is not a enlgish or number sentence,the file data have problem. FileOutputStream out = new FileOutputStream ("C:/workbook.xls"); HSSFWorkbook wb = new HSSFWorkbook(); HSSFRow r = null; HSSFCell c = null; r = s.createRow((short)0); c = r.createCell((short)0); String u="‘ªŽŽŒÜ˜ZŽµ"; c.setCellValue(u); c.setCellType( HSSFCell.CELL_TYPE_STRING ); c.setEncoding(HSSFCell.ENCODING_COMPRESSED_UNICODE); wb.write(out);
yes, for this you should set the encoding to the UTF_16 (which we need to correct to be more lear in 3.0)