STRICT_CHECK_FOR_QUOTING does not quote value that contains newline character (original) (raw)
If I enable STRICT_CHECK_FOR_QUOTING
public static void main(String[] args) throws JsonProcessingException {
CsvFactory csvFactory = CsvFactory.builder()
.enable(CsvWriteFeature.STRICT_CHECK_FOR_QUOTING)
.build();
ObjectMapper objectMapper = CsvMapper.builder(csvFactory).build();
ObjectWriter writer = objectMapper.writer();
String s = writer.writeValueAsString("line1\nline2");
System.out.println(s);
}
The output is:
But when I disable the Feature, output becomes
If I change the newline character to a comma, the value is enclosed no matter I enable or disable this Feature:
This does not follow the https://www.ietf.org/rfc/rfc4180.txt item 2.6