You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
HacktoberfestPotential candidate to participate in HacktoberfestIssue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-FixedThe issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdletsgeneral cmdlet issues
# Input 2.csv# a1,,a3# v1,v2,v3Import-csv .\2.csv -Delimiter ','# Output
WARNING: One or more headers were not specified. Default names starting with "H" have been used in place of any missing headers.
a1 H1 a3
------
v1 v2 v3
That's probably somewhere between a "why would you use that as delimiter" and "special case that needs dealing with". CSV entries with spaces need to be enclosed with (usually) double quotes. I don't know if there's another possible enclosing character that can be relied upon, really (single quotes maybe?)
The trouble with CSV is there isn't a concrete "standard" just a bunch of very similar implementations with some differences scattered throughout.
But I've never seen a CSV with double quotes as delimiter before... I'd be of the inclination that it be treated as a reserved character and not be permitted as a delimiter for parsing at all, but...
Took a look at the code, as noted above, double quotes is a special character for containing whitespace so that this:
"foo,bar","apple"
becomes:
foo,bar apple
and not:
foo bar apple
So using " as the delimiter breaks this. I think that unless there's a real scenario to use the double quote as a delimiter, it's not worth making a change. Otherwise, we'd special case if double quote is used, you cannot have whitespace as part of a value.
Ilya (@iSazonov) there's probably a bug in the logic when double quotes are used as the delimiter as there's special code already to handle double quotes to preserve whitespace. I think the question is whether it's worthwhile to spend time investigating and fixing something that is a corner case.
HacktoberfestPotential candidate to participate in HacktoberfestIssue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-FixedThe issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdletsgeneral cmdlet issues
Activity
iSazonov commentedon Sep 20, 2018
Steve Lee (@SteveL-MSFT) Have you any information about the special behavior? Is this side affect (bug) in the code or a standard?
vexx32 commentedon Sep 20, 2018
That's probably somewhere between a "why would you use that as delimiter" and "special case that needs dealing with". CSV entries with spaces need to be enclosed with (usually) double quotes. I don't know if there's another possible enclosing character that can be relied upon, really (single quotes maybe?)
The trouble with CSV is there isn't a concrete "standard" just a bunch of very similar implementations with some differences scattered throughout.
But I've never seen a CSV with double quotes as delimiter before... I'd be of the inclination that it be treated as a reserved character and not be permitted as a delimiter for parsing at all, but...
iSazonov commentedon Sep 21, 2018
The Issue is that we accept the delimiter and skip one column. So I'd expect that we either do not accept the delimiter or do not skip the column.
vexx32 commentedon Sep 21, 2018
The former sounds perfectly fine to me, but I'm unsure if there's a valid reason to use a double quote as a delimiter.
SteveL-MSFT commentedon Sep 21, 2018
Took a look at the code, as noted above, double quotes is a special character for containing whitespace so that this:
becomes:
and not:
So using
"as the delimiter breaks this. I think that unless there's a real scenario to use the double quote as a delimiter, it's not worth making a change. Otherwise, we'd special case if double quote is used, you cannot have whitespace as part of a value.iSazonov commentedon Sep 23, 2018
Steve Lee (@SteveL-MSFT) My question is should we address scenario from my repo steps where we lost column?
SteveL-MSFT commentedon Sep 25, 2018
Ilya (@iSazonov) there's probably a bug in the logic when double quotes are used as the delimiter as there's special code already to handle double quotes to preserve whitespace. I think the question is whether it's worthwhile to spend time investigating and fixing something that is a corner case.
iSazonov commentedon Sep 25, 2018
Yes, I think we can label this with Up-For-Grabs and Hackathon.