ng-csv icon indicating copy to clipboard operation
ng-csv copied to clipboard

Text delimiter ignores field separator

Open rlach opened this issue 10 years ago • 0 comments

If you set field-separator then the delimiter will be added to fields that use coma, regardless of what field-separator is used. Expected behavior is to add text-delimiter to fields that use field separator character.

Example: Let's have data like this:

{
   fieldA: 'I like apples, really',
   fieldB: 'if(a) return b; if(b) return a;'
}

With coma as field-separator and " as field-delimiter we get proper csv:

"I like apples, really",if(a) return b; if(b) return a;

Which is 2 fields. But if we instead use semicolon as field-separator and " as field-delimiter we get:

"I like apples, really";if(a) return b; if(b) return a;

Which is 4 fields: [ "I like apples, really", "if(a) return b", "if(b) return a", "" ]. Expected value in that case is actually:

I like apples, really;"if(a) return b; if(b) return a;"

Which is proper 2 fields.

rlach avatar Dec 31 '15 12:12 rlach