Jack Ukleja
Jack Ukleja

Reputation: 13511

Why is mercurial (hg) treating my Visual Studio solutions (.sln) as binary?

I get the message "File or diffs not displayed: File is binary."

Why is mercurial (hg) treating my visual studio solutions (.sln) as binary?

And how do I stop it?

Thanks

Upvotes: 3

Views: 286

Answers (2)

Ry4an Brase
Ry4an Brase

Reputation: 78330

For actual storage Mercurial treats all files as binary. It never does line conversions or anything else that requires considering things as text or knowing the file's encoding.

However, at the UI level (separate from the storage level) it will try to avoid filling your screen with binary gookus, and to do that it uses a simple test -- a file won't be displayed in diffs if it has one or more NUL (0x00) characters in it.

So your .sln file must have a 0x00 somewhere in it. The most common cause is misbehaving editors putting a Byte Order Mark (BOM) at the front of the file.

If you can remove the NUL Mercurial will display the file contents, and if you can't I think you're out of luck.

Upvotes: 2

manojlds
manojlds

Reputation: 301127

I tried this out on one of my projects and the sln file was treated as a text file. Check if your sln file is in a different encoding like UTF-16. Otherwise, Hg should not be treating it as binary. Try explicitly converting / changing the encoding to UTF-8 / ASCII and see.

Upvotes: 6

Related Questions