Skip to content

ToolTask UseUtf8Encoding value of 'true' is equal to 'always' #10949

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 18, 2024

Conversation

jrdodds
Copy link
Contributor

@jrdodds jrdodds commented Nov 7, 2024

Fixes #10907

Context

The UseUtf8Encoding property of the Exec task and other ToolTask derived tasks should accept true and equivalent to always.

Changes Made

ToolTask doesn't validate or interpret the UseUtf8Encoding property. The value of the property is passed to and interpreted by EncodingUtilities.BatchFileEncoding().

EncodingUtilities was modified to add a const string for TRUE and the BatchFileEncoding() method was modified to handle TRUE and ALWAYS the same.

Testing

Created a unit test that compares the returns for ALWAYS and TRUE, confirmed that the unit test failed, modified the code, and confirmed the unit test passes.

Tested on Windows.

Notes

On non-Windows platforms the UseUtf8Encoding property has no effect.

@jrdodds jrdodds changed the title ToolTask UseUtf8Encoding value of 'true' is equal to always ToolTask UseUtf8Encoding value of 'true' is equal to 'always' Nov 7, 2024
Copy link
Member

@maridematte maridematte left a comment

Choose a reason for hiding this comment

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

Looks good to me, we appreciate the fast work on the issue.

Copy link
Member

@rainersigwald rainersigwald left a comment

Choose a reason for hiding this comment

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

Thanks @jrdodds!

@rainersigwald rainersigwald merged commit 37fc828 into dotnet:main Nov 18, 2024
10 checks passed
@jrdodds jrdodds deleted the jrdodds/UseUtf8EncodingTrue branch November 19, 2024 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Treat UseUtf8Encoding=true as "always"
3 participants