GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||
GeezerVison is showing github.com — Add support LF newlines in Import-Csv by iSazonov · Pull Request #5363 · PowerShell/PowerShell Conversation
Collaborator
Fix #3692. Fix descriptionAfter the fix Import-Csv support CR (\r), LF (\n), CRLF (\r\n) as line delimiters.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Ilya (iSazonov)
requested review from
James Truher (JamesWTruher),
Paul Higinbotham (PaulHigin) and
Dan Travison (dantraMSFT)
as code owners
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
|
Yes, I added new test. Oops... lost commit. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| return ch == '\r' || ch == '\n'; | ||
| } | ||
|
|
||
| private |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
We
should
fix
this.
But thanks for being consistent. :)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Can we get a good project wide reformatting done right after release? So many times I'm just following the ugly formatting around the code and then have to point that out in reviews as to why my code looks weird or doesn't follow the conventions.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I ran the Roslyn code format tool on the code base before we went public - it didn't fix stuff like this, but we should run it again.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Maybe just after RTM take two formatting weeks to push as many formatting PRs as we can starting with Roslyn code format tool and continue with manual formatting.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| { | ||
| ReadChar(); | ||
| } | ||
| SkipNewLine(); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
If there are two newlines, won't this skip the second?
A better pattern might be to change IsNewLine to return a string ("\n", "\r", or "\r\n") or null, and if the newline must be appended, append the result. There should be no need for SkipNewLine.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I don't know about skipping empty lines. Formally RFC4180 don't allow empty lines. Although practically it may make sense.
I thought about the pattern ( IsNewLine to return a string ) and decided to begin with SkipNewLine() as seems more readable. Now I'm going to implement IsNewLine(out newLine).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I test with Windows PowerShell - we keep its behaviour and ignore empty lines.
Microsoft Excel imports empty lines as empty rows. We should discuss this in new Issue if we want because it is a breaking change.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…l#5363) With the fix, `Import-Csv` support CR (\r), LF (\n), CRLF (\r\n) as line delimiters.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Import-Csv does not handle newlines containing just \r (Carriage Return)
There was an error while loading. Please reload this page.