Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Trim leading and trailing whitespaces in a field, per the CSV spec (such... #28

wants to merge 1 commit into from

3 participants


... as it is)


@koles I've run into an issue that this commit would resolve. Any plans to merge this fairly minor change?


First, my apologies for the delayed response.

Which CSV spec are you referring to? I'd like to keep ya-csv compliant with which clearly states that "spaces are considered part of a field and should not be ignored."

I don't mind adding this feature but it cannot be the default behavior.

I've forgotten why I even ran into this problem ;) But you are right, rfc4180 does say that. I think the confusion is how to handle leading and trailing spaces in a non-quoted field. I wish I could remember where I ran into this...

I'd love to see this change as an optional feature at least...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/ya-csv.js
2  lib/ya-csv.js
@@ -204,7 +204,7 @@ CsvReader.prototype._addCharacter = function(c) {
CsvReader.prototype._addField = function() {
var ps = this.parsingStatus;
- ps.openRecord.push(ps.openField);
+ ps.openRecord.push(ps.openField.trim());
ps.openField = '';
ps.quotedField = false;
Something went wrong with that request. Please try again.