From fa437cb924ff6591faab05f7dc42dd5556676abd Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sun, 31 Jul 2016 00:29:29 -0700 Subject: [PATCH] Add testRfc4180QuoteSingleChar(). --- .../java/org/apache/commons/csv/CSVPrinterTest.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/test/java/org/apache/commons/csv/CSVPrinterTest.java b/src/test/java/org/apache/commons/csv/CSVPrinterTest.java index bc7ac9b5..3ee2438f 100644 --- a/src/test/java/org/apache/commons/csv/CSVPrinterTest.java +++ b/src/test/java/org/apache/commons/csv/CSVPrinterTest.java @@ -53,6 +53,7 @@ import org.junit.Test; */ public class CSVPrinterTest { + private static final char EURO_CH = '\u20AC'; private static final char DQUOTE_CHAR = '"'; private static final char BACKSLASH_CH = '\\'; private static final char QUOTE_CH = '\''; @@ -806,6 +807,15 @@ public class CSVPrinterTest { } } + @Test + public void testRfc4180QuoteSingleChar() throws IOException { + final StringWriter sw = new StringWriter(); + try (final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.RFC4180)) { + printer.printRecord(EURO_CH, "Deux"); + assertEquals("\"" + EURO_CH + "\",Deux" + recordSeparator, sw.toString()); + } + } + @Test public void testPrinter2() throws IOException { final StringWriter sw = new StringWriter();