Код: Выделить всё
Name;Quantity
"foo;bar";1
"foo"bar;2
Код: Выделить всё
[[foo;bar , 1] , ["foo"bar , 2]]
Код: Выделить всё
CsvMapper mapper = new CsvMapper();
CsvSchema schema = mapper.schemaFor(List.class).withColumnSeparator(';');
MappingIterator it = mapper.readerForListOf(String.class)
.with(schema)
.with(CsvParser.Feature.WRAP_AS_ARRAY)
.readValues(textInput);
Код: Выделить всё
com.fasterxml.jackson.databind.JsonMappingException: Unexpected character ('b') Expected column separator character (';' (code 59)) or end-of-line at [...]
Если кавычки начинаются с середины поля, проблем нет.
Я могу решить проблема для второй строки, изменив CsvSchema на:
Код: Выделить всё
CsvSchema schema = mapper.schemaFor(List.class).withColumnSeparator(separator).withoutQuoteChar();
Есть ли способ проанализировать CSV файлы, содержащие поля, начинающиеся с кавычек и с полями, заключенными в кавычки?
Подробнее здесь: https://stackoverflow.com/questions/781 ... aformat-cs