KirillOsenkov/CodeCleanupTools

TextAndWhitespace removes BOM

sliekens opened this issue · 2 comments

According to the README, the TextAndWhitespace tool should save text files with a byte-order-mark. This is not what the code actually does.

See: https://github.com/KirillOsenkov/CodeCleanupTools/blob/master/TextAndWhitespace/TextAndWhitespace.cs#L111

The overload of File.WriteAllText(String, String) that is used uses UTF-8 without BOM. See the remarks section on MSDN. https://msdn.microsoft.com/en-us/library/ms143375(v=vs.110).aspx#Anchor_2

It's not clear if this is a code issue or a documentation issue. Is it actually desirable to save files with a BOM? How well does Git handle files with or without a BOM?

Sorry if this caused any trouble. It was with BOM originally, but I've done a lot of research and changed it to no-BOM eventually, because it's generally considered more favorable. Nobody uses BOM outside the certain Microsoft stack.

Here's an example:
https://github.com/chocolatey/choco/wiki/CreatePackages#character-encoding

Most tools should handle UTF-8 without BOM just fine. I've updated the docs to match the behavior.

Thanks for clearing that up. :)