Skip to content
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

Only read files that are UTF8 or UTF8 BOM #787

Merged
merged 10 commits into from
Jan 15, 2023
Merged

Only read files that are UTF8 or UTF8 BOM #787

merged 10 commits into from
Jan 15, 2023

Conversation

belav
Copy link
Owner

@belav belav commented Jan 9, 2023

closes #768

Previously UTF.Unknown was used to try to determine file encodings. This was problematic because if a file was too small, it would end up with several possible encodings. The encoding it considered most likely was not always correct. As opposed to trying to read a file as each encoding type, CSharpier now only supports UTF8 files. This is consistent with the IDE plugins, which stream files to CSharpier as UTF8. If a file is UTF8-BOM, it will retain the BOM.

shocklateboy92
shocklateboy92 previously approved these changes Jan 11, 2023

public enum MeetingLocation
{
Café,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Uh... do you want to make the test case Café like the bug? Café kind of makes no sense.

Copy link
Owner Author

Choose a reason for hiding this comment

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

I'm thinking whatever you are looking at this code with isn't interpreting the file correctly? This is what I see
image

Src/CSharpier.Cli/FileReader.cs Outdated Show resolved Hide resolved
Co-authored-by: Lasath Fernando <devel@lasath.org>
@belav belav merged commit 4fa0aa9 into master Jan 15, 2023
@belav belav deleted the file-encoding-issue branch January 15, 2023 16:46
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.

Error in MSBuild package when code contains an acute accent
2 participants