Repository navigation
Respect explicit false for CSV UseCulture - #27514
Open
Kirtikumar Anandrao Ramchandani (KirtiRamchandani) wants to merge 1 commit into
Open
Kirtikumar Anandrao Ramchandani (KirtiRamchandani) wants to merge 1 commit into
Kirtikumar Anandrao Ramchandani (KirtiRamchandani) wants to merge 1 commit into
Conversation
Kirtikumar Anandrao Ramchandani (KirtiRamchandani)
requested a review
from a team
as a code owner
May 24, 2026 13:49
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds coverage and fixes delimiter selection so that specifying -UseCulture:$false behaves the same as omitting -UseCulture (i.e., uses the default CSV delimiter rather than the culture list separator).
Changes:
- Add Pester tests validating default delimiter behavior when
-UseCultureis explicitly set to$falseacrossImport-Csv,Export-Csv,ConvertTo-Csv, andConvertFrom-Csv - Update
SetDelimiterto explicitly pick either the culture list separator (whenuseCultureis true) or the default CSV delimiter (when false)
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/powershell/Modules/Microsoft.PowerShell.Utility/Import-Csv.Tests.ps1 | Adds test for Import-Csv -UseCulture:$false |
| test/powershell/Modules/Microsoft.PowerShell.Utility/Export-Csv.Tests.ps1 | Adds test asserting comma delimiter when -UseCulture:$false |
| test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Csv.Tests.ps1 | Adds test asserting comma delimiter output when -UseCulture:$false |
| test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertFrom-Csv.Tests.ps1 | Adds test asserting comma delimiter parsing when -UseCulture:$false |
| src/Microsoft.PowerShell.Commands.Utility/commands/utility/CsvCommands.cs | Fixes delimiter selection logic for -UseCulture:$false in UseCulture-related parameter sets |
Fix ConvertTo-Csv/Export-Csv/Import-Csv/ConvertFrom-Csv delimiter selection when -UseCulture:$false is passed explicitly. Treat explicit false the same as omitting the switch and use the default comma delimiter. Fixes PowerShell#26513
Kirtikumar Anandrao Ramchandani (KirtiRamchandani)
force-pushed
the
fix/csv-useculture-false
branch
from
June 14, 2026 08:33
f3acfeb to
396098a
Compare
Contributor
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
Makes CSV commands treat
-UseCulture:$falsethe same as omitting-UseCulture, so the default comma delimiter is used.PR Context
Fix #26513.
ImportExportCSVHelper.SetDelimiter()previously left the delimiter as the defaultcharvalue when the active parameter set was a culture parameter set but theUseCultureswitch value was explicitly false. This affected multiple CSV commands that share the helper. The helper now falls back to the default CSV delimiter whenUseCultureis false, while preserving the culture-specific delimiter when it is true.Regression tests cover:
ConvertTo-Csv -UseCulture:$falseExport-Csv -UseCulture:$falseImport-Csv -UseCulture:$falseConvertFrom-Csv -UseCulture:$falsePR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerValidation
Start-PSBuild -PSModuleRestore -UseNuGetOrgStart-PSPester -Path test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Csv.Tests.ps1,test/powershell/Modules/Microsoft.PowerShell.Utility/Export-Csv.Tests.ps1,test/powershell/Modules/Microsoft.PowerShell.Utility/Import-Csv.Tests.ps1,test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertFrom-Csv.Tests.ps1 -UseNuGetOrg -ThrowOnFailure -Terse -SkipTestToolBuildResult: CSV command tests passed: 92 passed, 0 failed.