views:

278

answers:

1

Apparently, when Visual Studio 2008 (SP1) opens a CSS file, it doesn't recognize the UTF8 BOM marker as a BOM, but instead interprets it as text (first three characters show up as , but shouldn't be visible). While VS normally doesn't save the CSS files with a BOM, I'd expect the IDE to recognize and respect the BOM when it's there.

This may be a bug with Visual Studio, however, does anyone know a workaround?

+1  A: 

This appeared to be a bug in Visual Studio 2008 SP1. Once it misinterprets the CSS file, it will continue misinterpreting it. Signs on the sand were, too, that rightclicking and selecting "Open With" did not work for any internal editor.

Closing Visual Studio and reopening it didn't work. What worked eventually was:

  • Rightclick the CSS file, select Open With and select CSS Source Editor With Encoding
  • Click Set as Default, then click OK. Nothing will happen.
  • Close all editors. Close Visual Studio
  • Reopen Visual Studio and your solution or project.
  • Double click the CSS file. It will ask for the encoding. Select Auto. It should now open correctly.
  • Rightclick again and set the default editor back to CSS Source Editor (otherwise you'll always have to select the encoding manually).

Or in short: associate with "With Encoding", restart VS, open CSS correctly with encoding "Auto", re-associate with default CSS Editor, done.

Abel