I have recently downloaded Visual Studio 2017 (Community, v15.5.6) and found a strange quirk when creating a new project. It wasted a few hours, which always makes something worthy of a walkthrough.
I created a new Visual C++ Windows Console Application, which starts with the following source code files:
Then there are the project files:
Now, when you view the source files on your chosen Git tool, it will interpret them as binary and give you no information whatsoever about their text contents. This is, of course, really annoying. What’s even stranger, the project files appear as text in the viewer just as you would expect.
The easiest way I found to troubleshoot and fix it was to open the files in Notepad++. Click on the Encoding menu, and what do you see:
The source code has been encoded as UTF-16, which Git cannot deal with.
This can be solved in the same place by simply clicking on “Encode in UTF-8” and saving the file. Git will now recognise it as text.
What elevates this from annoying to downright perplexing is that if you add a new file to your project, it created as UTF-8. With the project files also being UTF-8, it is these four initial files that are the exception, not the rule.
This is a known issue, and will hopefully be fixed soon.