Jackson CSV. Quote escaping in headers

434 Views Asked by At

I have a CSV file in which one of the headers looks like Name;Lastname;"Some info\n more info"

My parser:

        CsvMapper csvMapper = new CsvMapper();
        CsvSchema csvSchema = CsvSchema.emptySchema()
                .withHeader()
                .withColumnSeparator(';');
            MappingIterator<Map<String, String>> mappingIterator = csvMapper
                    .readerFor(Map.class)
                    .with(csvSchema)
                    .readValues(new InputStreamReader(
                            new FileInputStream("myFilePath"),
                            Charset.forName("windows-1250")
                    ));

But after parsing, I lose the quotes in the header and get just Name;Lastname;Some info\n more info. How can I save quotes?

0

There are 0 best solutions below