Check that Unicode works with the MYSQL format which uses backslash as its escape character
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1300591 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ecf59bef6e
commit
f8294d2d22
|
@ -361,6 +361,17 @@ public class CSVParserTest extends TestCase {
|
|||
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));
|
||||
|
|
Loading…
Reference in New Issue