Author: sebb
Date: Wed Mar 14 15:26:14 2012
New Revision: 1300591
URL: http://svn.apache.org/viewvc?rev=1300591&view=rev
Log:
Check that Unicode works with the MYSQL format which uses backslash as its
escape character
Modified:
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java
Modified:
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java?rev=1300591&r1=1300590&r2=1300591&view=diff
==============================================================================
---
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java
(original)
+++
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java
Wed Mar 14 15:26:14 2012
@@ -361,6 +361,17 @@ public class CSVParserTest extends TestC
assertFalse("Should not have any more records", iterator.hasNext());
}
+ public void testUnicodeEscapeMySQL() throws Exception {
+ String code = "abc\t\\u0070\\u0075\\u0062\\u006C\\u0069\\u0063";
+ CSVParser parser = new CSVParser(code,
CSVFormat.MYSQL.withUnicodeEscapesInterpreted(true));
+ final Iterator<String[]> iterator = parser.iterator();
+ String[] data = iterator.next();
+ assertEquals(2, data.length);
+ assertEquals("abc", data[0]);
+ assertEquals("public", data[1]);
+ assertFalse("Should not have any more records", iterator.hasNext());
+ }
+
public void testCarriageReturnLineFeedEndings() throws IOException {
String code = "foo\r\nbaar,\r\nhello,world\r\n,kanu";
CSVParser parser = new CSVParser(new StringReader(code));