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

Don't change BOM for existing project files - fixes #2271 #2575

Merged
merged 1 commit into from Aug 17, 2017

Conversation

Projects
None yet
3 participants
@TeaDrivenDev
Contributor

TeaDrivenDev commented Jul 31, 2017

As mentioned in #2271, some project files have a BOM (created by VS), others don't (from Ionide/Forge), so to know what "unchanged" means, we have to probe the original file and set the encoding for writing the XML file accordingly. We only consider UTF-8 because it seems safe to assume all project files will have that.

@TeaDrivenDev

This comment has been minimized.

Show comment
Hide comment
@TeaDrivenDev

TeaDrivenDev Aug 1, 2017

Contributor

Updated with a better way to get the bytes to compare against.

@forki What did you mean earlier with "What happens if it's 3 bytes"? If the file is shorter than what we're trying to read, FileStream.Read() will take what it can get and return the number of bytes as an integer (which we ignore). That would leave us with a byte array that is not equal to the expected BOM, and we would decide to write the project file without a BOM.

Contributor

TeaDrivenDev commented Aug 1, 2017

Updated with a better way to get the bytes to compare against.

@forki What did you mean earlier with "What happens if it's 3 bytes"? If the file is shorter than what we're trying to read, FileStream.Read() will take what it can get and return the number of bytes as an integer (which we ignore). That would leave us with a byte array that is not equal to the expected BOM, and we would decide to write the project file without a BOM.

@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Aug 17, 2017

Member

thx!

Member

forki commented Aug 17, 2017

thx!

@forki forki merged commit 9150a63 into fsprojects:master Aug 17, 2017

1 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment