Search code examples
javautfimport-from-excel

Read Turkish Character from Excel in Java


I have a script that reads rows from Excel and writes to my DB (PostgreSQL). Everything is OK but there are some problems when sentences include Turkish characters (ç, ü, ğ etc). Some of these sentences work fine and some don't. Examples:

Çocuklar şu anda parkta (in Excel) -> Çocuklar şu anda parkta (in Java) is not problem

Sue evli ve iki çocuklu (in Excel) -> Sue evli ve iki �ocuklu (in Java) is problem

Both of them include that ç.

How I can convert true format?


Solution

  • WorkbookSettings workbookSettings = new WorkbookSettings();
    workbookSettings.setEncoding( "Cp1252" );//or other encoding
    Workbook.getWorkbook( theFile, workbookSettings );