Search code examples
javaencodingutf-8jxl

Read File using JXL with UTF-8 Encoding


I am needing to read a excel file using lib JXL with UTF-8 Encoding.

I already try using WorkbookSettings as bellow:

 WorkbookSettings ws = new WorkbookSettings();
 ws.setEncoding("UTF-8");
 Workbook workbook = Workbook.getWorkbook(fileInputStream,ws);

But didn't work.

I also try to convert the output string to utf-8 using the bytes as bellow:

Charset.forName("UTF-8").encode(myString);
String value = new String(myString.getBytes("UTF-8"));

But still doesn't work:

This is my output:

Can you help me?

output here


Solution

  • I resolved the problem changing the WorkbookSettings to:

    WorkbookSettings ws = new WorkbookSettings(); 
    ws.setEncoding("Cp1252");
    

    I belived it is the format the file is.