Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix UseCulture: behavior for CSV delimiter #26513#26551

Open
blanca-negrete wants to merge 1 commit into
PowerShell:masterPowerShell/PowerShell:masterfrom
blanca-negrete:fix-useculture-delimiterblanca-negrete/PowerShell:fix-useculture-delimiterCopy head branch name to clipboard
Open

Fix UseCulture: behavior for CSV delimiter #26513#26551
blanca-negrete wants to merge 1 commit into
PowerShell:masterPowerShell/PowerShell:masterfrom
blanca-negrete:fix-useculture-delimiterblanca-negrete/PowerShell:fix-useculture-delimiterCopy head branch name to clipboard

Conversation

@blanca-negrete

@blanca-negrete blanca-negrete commented Dec 1, 2025

Copy link
Copy Markdown

PR Summary

Fix #26513

Fixes behavior where ConvertTo-Csv and Export-Csv incorrectly used the culture-specific delimiter even when explicitly passed -UseCulture:$false. When UseCulture is set to $false, the commands now correctly fall back to the default comma (,) delimiter.

PR Context

-UseCulture:$false was not being treated the same as omitting -UseCulture.
This resulted in inconsistent delimiter behavior, especially in cultures that use ; as the list separator.
This PR updates ImportExportCSVHelper.SetDelimiter to ensure that UseCulture:$false properly defaults to the standard CSV delimiter.

PR Checklist

else
{
delimiter = ImportExportCSVHelper.CSVDelimiter;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use conditional operator.

delimiter = useCulture ? ... : ...

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@blanca-negrete Please address my request.

@iSazonov iSazonov added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Dec 3, 2025
@surfingoldelephant

surfingoldelephant commented Dec 4, 2025

Copy link
Copy Markdown

The PR needs to be marked as fixing issue:

@microsoft-github-policy-service microsoft-github-policy-service Bot added the Review - Needed The PR is being reviewed label Dec 11, 2025
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug where ConvertTo-Csv and Export-Csv incorrectly used the culture-specific delimiter even when explicitly passed -UseCulture:$false. The fix ensures that when UseCulture is explicitly set to $false, the commands correctly fall back to the default comma (,) delimiter instead of using the culture-specific list separator.

Key Changes

  • Added an else block in ImportExportCSVHelper.SetDelimiter to handle the case when useCulture is false, ensuring it falls back to the default CSV delimiter (comma)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1806 to +1809
else
{
delimiter = ImportExportCSVHelper.CSVDelimiter;
}

Copilot AI Dec 12, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix for handling UseCulture:$false correctly lacks test coverage. While the fix itself is correct, automated tests should be added to verify that:

  1. When -UseCulture:$false is explicitly specified, the default comma delimiter is used (not the culture-specific delimiter)
  2. When -UseCulture is omitted, the default comma delimiter is used
  3. When -UseCulture or -UseCulture:$true is specified, the culture-specific delimiter is used

These tests would prevent regression of issue #26513 and can be added to the existing test files (e.g., ConvertTo-Csv.Tests.ps1 or ImportExportCSV.Delimiter.Tests.ps1).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log Review - Needed The PR is being reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ConvertTo-Csv/Export-Csv -UseCulture:$false uses the wrong delimiter in ouput

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.