Site icon Washam Development

Weird &#65279 Character in HTML

I was recently working on a simple HTML project and created the basic HTML files in Visual Studio 2015. Nothing crazy. But when I ran the project in Chrome, there was some extra space at the top of the page that wasn’t coming from CSS. After inspecting the HTML in Developer Tools, I noticed a strange  character appearing in the HTML.

I read that these characters are BOMs, or byte order marks (also could be known as zero width no-break space). Some people were able to get rid of these characters by rewriting their HTML file by hand, but even after doing this, the characters were still there.

I finally found this StackOverflow post that describes how Visual Studio evidently saves UTF-8 files “with signature” by default, which also saves BOM characters.

You can save files “without signature” by using the Advanced Save Options in the File menu of Visual Studio.

This will remove any BOM characters from your files.

I also added the Advanced Save Options command to my quick access toolbar:

  1. Right-click on the toolbar in Visual Studio, then click Customize.
  2. Click the Commands tab.
  3. In Toolbars menu, find Standard.
  4. Click Add Command and add Advanced Save Options.
  5. Move it where you want (I moved it under Save).
Exit mobile version