tengo un formulario con un jtable el cual carga un archivo de excel dentro de el, el problema es que no me carga las ñs o caracteres especiales
Me salen esos símbolos de pregunta. este el el codigo del boton agregar
private void btn_importarActionPerformed(java.awt.event.ActionEvent evt) {
try {
for (int i = 0; i < jtabla.getRowCount(); i++) {
modelo.removeRow(i);
i -= 1;
}
} catch (Exception e) {
}
JFileChooser fileChooser = new JFileChooser();
FileNameExtensionFilter filter = new FileNameExtensionFilter("Archivos Excel (*.xls)", "xls");
fileChooser.setAcceptAllFileFilterUsed(false);
fileChooser.setFileFilter(filter);
fileChooser.setDialogTitle("BUSCAR ARCHIVO");
if (fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
String ruta = fileChooser.getSelectedFile().getAbsolutePath();
File f = new File(ruta);
try {
Workbook wb = Workbook.getWorkbook(f);
Sheet s = wb.getSheet(0);
int row = s.getRows();
int col = s.getColumns();
String[] datos;
for (int i = 0; i < row; i++) {
datos = new String[col];
for (int j = 0; j < col; j++) {
Cell c = s.getCell(j, i);
datos[j] = c.getContents();
System.out.print(c.getContents());
}
System.out.println("");
if (i == 0) {
modelo.setColumnIdentifiers(datos);
} else {
modelo.addRow(datos);
}
}
jtabla.setModel(modelo);
} catch (Exception e) {
}
}
}
Ya estuve investigando sobre convertir a UTF-8 pero no se en que momento deberia hacerlo y como. intente convertir el archivo FILE
o al momento del getContents
pero no me da resultado ninguna forma.
Gracias de antemano
String content = new String(c.getContents.getBytes("UTF-8"));