linux - Character encoding issue while reading an Excel file in a Java Web App -
in java web app, i'm using jexcel api read excel files sent clients.
i'm doing :
byte[] excelfile = ... inputstream inputstream = new bytearrayinputstream(excelfile); workbooksettings ws = new workbooksettings(); ws.setencoding("cp1252"); workbook w = workbook.getworkbook(inputstream, ws); ...
struts gives me excel file byte array (i use formfile#getfiledata() method).
it works ok on windows. quite different on linux. while cells can parsed correctly , content interpreted (even if there non ascii characters 'à', 'ê', etc), sheet names not. bad characters '?' or '�'.
i forced workbook encoding utf-8 :
ws.setencoding("utf-8");
but there no effect.
i changed excel file utf-8 too, nothing happens. don't understand why not work, sheet names, since whole chain in utf-8 (i have servlet filter forces http requests encoding utf-8 too).
i had similar problem java excel api. problem excel tries smart , replace characters you. example of in case excel replaced 3 dots '...' singe character representing 3 dots out of it's own character set non-standard utf-8. framework didn't recognize , got similar undefined character (�') getting. fix had manually edit excel spreadsheets , worked ok. big problem had finding characters was. not sure if option though.