December 15, 2008

 - Weird characters in Visual Studio 2008

I am using VS 2008 while most of my team is on 2005. Recently after syncing with CVS, my solution would not build. One of my code-behind files had the characters “” prepended to it. After a bit of googling, I found this:

“Those are the marks some Windows applications use to distinguish UTF-8 from ASCII (they are a translation of the U+FEFF byte order marks into UTF-8). I’ve never done anything with VS and aspx, so I don’t know how to get rid of them. Maybe there is a way to tell VS to save things in UTF-8 without the marks (if you still want them to be UTF-8) or to just save them in ASCII (if you don’t care about UTF-8).” (from here)

According to Wikipedia, “a text editor that does not recognize UTF-8 will display “” at the start of the document, even if the UTF-8 contains only ASCII and would otherwise display correctly.” Hmmm, sounds like our issue, doesn’t it?

So, I dug around in Visual Studio until I found the “Auto-detect UTF-8 encoding without signature” option (Tools->Options->Text Editor)

That did the trick. I re-synced with CVS and verified that the issue is gone. The “” characters are no longer showing up.

Comments
blog comments powered by Disqus