iryndin / jdbf

Java utility to read/write DBF files
108 stars 77 forks source link

Character length #47

Open deanon opened 6 years ago

deanon commented 6 years ago

Hi, there is an issue with Character field's length (byte 17 should be considered as hi part of length word for character, see http://www.autopark.ru/ASBProgrammerGuide/DBFSTRUC.HTM ), and here is how I've fixed it:

 switch (type) {
            case Character:
                length = (fieldBytes[17] << 8) | (fieldBytes[16] & 0xff);
                break;
            default:

                length = fieldBytes[16];
                if (length <= 0)
                    length = 256 + length;
        }
iryndin commented 6 years ago

@deanon can you please make PR and also, add a test for it?