Open fabiosebastiano-vertical opened 1 year ago
Hello, Everything seems to be correct. I want to slightly correct the entry in the dbf file:
String newDBF = "final_file.dbf";
Object[] rowObjects = reader.nextRecord();
Object rowData[] = new Object[numberOfFields];
try (DBFWriter entry = new DBFWriter(new FileOutputStream(new DBF), Charset.forName("iso-8859-1"))) {
writer.setFields(fields);
while (rowObjects != null) {
for (int i = 0; i < rowObjects.length; i++) {
// DO SOMETHING WITH THE STRINGS
}
writer.addRecord(rowData);
}
}
I also read the incoming dbf file a little differently, you can see it in my repository: https://github.com/sumenkov/DBFandExcel
If you give a link to the original dbf file, I'll try to rewrite and check the encoding status :)
Hi, I'm using this library to change the column size/type of some DBF created with GEOTOOL package. The original version of the DBF files works fine, but when I create a new DBF from the scratch, add the headers and the fields read from the original file (that are in ISO-8859-1), no matter what i do, the final files have a different (windows-1252) charset.
As you can see in the following snippet, I'm passing the charset to the reader and to the writer and, if i print out the charset with the proper method, it seems properly set (ISO-8859-1), but If i open the shape file in QGIS, it says that it has the "windows-1252" charset.
`
`
Could you please help me?