Closed junit closed 2 years ago
Thanks for your report. That's a tough one.
When I developed the support for random access file operations in 2.1.0 I didn't consider that there's a fundamental problem:
The method de.siegmar.fastcsv.reader.CsvRow#getStartingOffset
returns the a character offset where java.io.RandomAccessFile#seek
seeks to a byte offset.
When the file only uses single byte characters (basically ASCII) this isn't a problem. The file you're referring to has a three byte Unicode character 0xE28099
(\u2019
in java – the apostrophe in "Women’s") in position 3510 (byte offset). As a consequence FastCSV returns a character start offset of 4014 for the next (seventh) row but the byte offset is 4016.
As it is not possible to seek to a character offset, CsvRow would need to be changed in order to return a byte offset.
I'll think about this.
The feature added with #57 will be removed from the next release as the current approach is not suitable (as this issue revealed). It seems that quite a lot of work is needed to implement it in a working way. I will open a new ticket for that.
Just released as part of 2.2.0
Describe the bug random access by offset is incorrect. testfile: Item.csv runtime log:
To Reproduce JUnit test to reproduce the behavior:
Additional context Java distribution and version to be used (output of
java -version
).