Menu

#14 AbstractCsvWriter: Quoting trailing whitespace

2.0.0-beta-1
closed
None
5
2012-09-16
2008-11-18
No

Hi,

AbstractCsvWriter.escapeString, Line 60, Ver. 1.52:
For column values containing leading whitespace, escaping is turned on.

For trailing whitespace, this is not done.

This can be fixed by adding:

if( csvElem.charAt(lastPos) == whiteSpace ) {
needForEscape = true;
}

at AbstractCsvWriter.escapeString, Line 98.

Unfortunately, I cannot upload files from my office account.

Quoting trailing whitespace, too, is important for all my use cases, as otherwise CsvListReader trims this whitespace away, thereby changing the raw data (Input into CsvListWriter is different from output of CsvListReader).

PS: The if and else branch beginning at line 77 contain the same statements.

Pete

Discussion

  • Ignat Alexeyenko

    Mr Kasper B. Graversen, I confirm that this is a bug and we have a really trivial patch for this. Could you please update the library?

    We can send our patch for you.

    I suppose that you find some time to support your project. Thank you!

    --
    Kind regards,
    Ignat Alexeyenko.

     
  • James Bassett

    James Bassett - 2012-07-06

    I've fixed this for the upcoming release (see revision 228).
    Thanks for the suggestions - I'll be adding you as a contributor to the pom :)

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.