Handling of regex-unsafe separators is broken since version 5.8
Brought to you by:
aruckerjones,
sconway
The commit at https://sourceforge.net/p/opencsv/source/ci/c20025253285ab42c1032f54c69370fff78b6ea3/ introduced a regression in how regex-unsafe separators are parsed, because it introduced code that confuses separator byte with its regex-escaped string version. Currently this test fails:
@Test
public void parseToLineUsesCorrectSeparator() {
CSVParserBuilder builder = new CSVParserBuilder();
ICSVParser parser = builder.withSeparator('.').withQuoteChar('\'').build();
String[] items = {"This", " is", " a", " test."};
assertEquals("This. is. a.' test.'", parser.parseToLine(items, false));
}
Fix with test: https://sourceforge.net/p/opencsv/source/merge-requests/37/
Hello Piotr - I have merged your fix in and will try to get it deployed this weekend but with the holidays and family coming in it will probably be in May before I can get it out.
I want to thank you for writing such a good test that perfectly demonstrated the problem. It quickly enabled me to try different configurations (like strict quotes) and the RFC4180Parser to quickly find that this is indeed a problem and went ahead and merged your fix.
And thank you for running all the integration tests - even the ones that don't normally run. After the release I will go through and clean up those tests. A Lot of the integration tests that don't run were tests I created to test issues or questions raised by developers but got left for lack of response. I will go through the tests to see what is a duplicate or not for issues that I closed and delete those tests.