简体   繁体   中英

How to read foreign characters from a cell in excel sheet using Apache POI and store them in database using SQLITE?

I am using Apache POI to read the text values from the cells in an excel sheet.

String str = cell.getStringCellValue();

However, when the cell contains text other than English, say , from any foreign language , it does not get stored in the string variable. What am I supposed to do in order to make it compatible with unicode characters as well?

Moreover, can I store them safely in a database using Sqlite ?

If you are using eclipse IDE change the encoding to UTF-8. Project > Properties > Resources > Text file encoding > Other > UTF-8

Use the data formatter as well.

DataFormatter formatter = new DataFormatter();
LOGGER.info(formatter.formatCellValue(cell));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM