-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugResolution-AnsweredThe question is answered.The question is answered.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility module
Description
Steps to reproduce
Using the following as a test (this is valid CSV).
label,testvalue
"blank",""
"null",
"comma","the quick, brown, fox"
"single-quote","the quick 'brown' fox"
"double-quote","the quick ""brown"" fox"
"newline","the quick brown
fox"
"newline after double-quote","the quick ""brown""
fox"
"newline before double-quote","the quick ""brown
"" fox"
"double-quote comma newline","the quick ""brown"",
fox"
PS> (gc test.csv | convertFrom-csv) | Export-csv -Path test2.csv -NoTypeInformation
# or
PS> (gc test.csv | convertFrom-csv) | ConvertTo-Csv -NoTypeInformation | Out-File -Path test2.csv -NoTypeInformationExpected behavior
The output file should look the same as the input file
Actual behavior
Its OK that there are quotes around everything now but the formatter has closed the double-quote before the line break and as a result introduced new records into the file.
"label","testvalue"
"blank",""
"null",
"comma","the quick, brown, fox"
"single-quote","the quick 'brown' fox"
"double-quote","the quick ""brown"" fox"
"newline","the quick brown"
"fox""",
"newline after double-quote","the quick ""brown"""
"fox""",
"newline before double-quote","the quick ""brown"
" fox""",
"double-quote comma newline","the quick ""brown"","
"fox""",
Environment data
$PSVersionTable
Name Value
---- -----
PSVersion 5.1.17763.316
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.316
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1Metadata
Metadata
Assignees
Labels
Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugResolution-AnsweredThe question is answered.The question is answered.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility module