How to get Visual Studio to adhere to the specification at the beginning of a UTF-8 encoded CSS file?

Apparently, when Visual Studio 2008 (SP1) opens the CSS file, it does not recognize the UTF8 specification marker as a specification, but interprets it as text (the first three characters are displayed as  , but shouldn’t be visible). Although VS usually does not save CSS files with a specification, I would expect the IDE to recognize and respect the specification where it is.

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

+4
source share
1 answer

This turned out to be a bug in Visual Studio 2008 SP1. Once it misinterprets the CSS file, it will continue to misinterpret it. Signs in the sand also showed that the right key and the “Open with” option did not work for any internal editor.

Closing Visual Studio and reopening it did not help. What ultimately happened:

  • Right-click the CSS file, select "Open With" and select "Encoding CSS Source Code Editor"
  • Click Set as Default, then click OK. Nothing will happen.
  • Close all editors. Close Visual Studio
  • Re-launch Visual Studio and your solution or project.
  • Double-click the CSS file. He will request an encoding. Select Auto. Now it should open correctly.
  • Rightclick again and return the default editor to the CSS source editor (otherwise you will always need to select the encoding manually).

Or, in short: link to "With Encoding", restart VS, open CSS correctly with "Auto" encoding, re-link to the default CSS editor.

+3
source

Source: https://habr.com/ru/post/1299932/


All Articles