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 -NoTypeInformation
Expected 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.1
Steps to reproduce
Using the following as a test (this is valid CSV).
Expected 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.
Environment data