[GJC-31] Doesn't quote the field when the field contains a block delimiter | |
| Status: | Open |
| Project: | Genjava |
| Component/s: | gj-csv |
| Affects Version/s: | csv-1.0 |
| Fix Version/s: | |
| Type: | Bug | Priority: | Major |
| Reporter: | Trejkaz | Assignee: | Henri Yandell |
| Resolution: | Unresolved | ||
| Environment: | |||
| Description |
| If I do something like this: csvWriter.writeField("a\nb"); The output is: a <newline> b The output probably should be: <dbl-quote> a <newline> b <dbl-quote> A similar unusual issue occurs if the field itself starts or ends with double-quotes. |
| Comment by trejkaz [ Sun, 19 Mar 2006 16:32:08 -0800 (PST) ] |
| Here's a patch to escape quotes and block delimiters properly. |
| Comment by bayard [ Mon, 27 Mar 2006 00:25:50 -0800 (PST) ] |
| Thanks for the patch/bug report Trejkaz. Sorry for the delay in replying, I was away last week. I'll get to looking at the patch asap. |
| Comment by trejkaz [ Tue, 6 Jun 2006 16:40:57 -0700 (PDT) ] |
| Is this not applied yet? |
| Comment by bayard [ Tue, 6 Jun 2006 17:36:12 -0700 (PDT) ] |
| Nope, pretty pathetic I know. More in that I didn't reply to here with the info on why it didn't get applied. Applying the patch made a unit test fail and I haven't dug into figuring out why: Testcase: testEscapeQuotes(com.generationjava.io.CsvWriterTest): FAILED Does not write simple csv file out correctly. expected:<...Not "Monkey...> but was:<..."Not ""Monkey""...> junit.framework.ComparisonFailure: Does not write simple csv file out correctly. expected:<...Not "Monkey...> but was:<..."Not ""Monkey""...> at com.generationjava.io.CsvWriterTest.testEscapeQuotes(CsvWriterTest.java:114) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) |