Skip to main content
Added a link to a post citing Cathy Wissink, Microsoft.
Source Link

How can I stop the auto-change encoding?

How can I stop the auto-change encoding?

By your descriptionAccording to your own comment, the Auto Guess Encoding the Auto Guess Encoding is already off. 
The fact that VS Code still encodes your file as Windows-1252 (code page 1252 or CP1252) needs
calls for some other explanation.

I cannot know for sure what caused your situation.By assuming that you have a VS Code setting that specifically decodes your CSS files
But I'veas being Windows-1252, I've been able to reproduce ityour situation very accurately, and therefore think the scenario I present below plausibly describes what might have happened. 1

I will reproduce the essence of all your findings.
In doing so, I use a simplified version of your style.css filesimplified version of your style.css, containing just a single line :

To make VS Code open the file with encoding Windows-1252 (with Auto Guess Encoding off), 
I will assume that the VS Code settings.json contains the followingthe following code/line : 12

Such a setting will make VS Code encode all .css files as Windows-1252
(also known as CP-1252 – the most common type of ANSI encoding). 23

The file SuperUser-Q1419830.zip contains the file style.css
(containing /* Ü */ encoded as UTF-8).
IfIf you download and unzip itstyle.css, then right-click style.cssit and Open with Code, expect to see :

The reason you see two Windows-1252 characters – Ãœ – instead of the single UTF-8 Ü character, is that Windows-1252 reads each byte as a single character – the non-ASCII characters à and œ. 
UTF-8 on the other hand uses two bytes to read a single non-ASCII character like Ü. 34

1.A a. How to display Ü correctly

To make the German letter Ü appear correctly, you need to click : 
Reopen with Encoding > UTF-8 Guessed from contentReopen with Encoding > UTF-8 Guessed from content.

'Reopen with Encoding' changes how the file is encoded.'Reopen with Encoding' changes how the file is decoded.

Choosing Reopen with Encoding doesn't change the file itself. 
It changes how the file is displayed in VS Code – how it is encodeddecoded.

1.B b. What you should not do

You'll get a problem if you instead click : 
Save with Encoding > UTF-8 Guessed from contentSave with Encoding > UTF-8 Guessed from content.

This does change the file – all non-ASCII characters get converted to their corresponding UTF-8 characters, and. If you save the file, it is saved saved with these changes.

The reason you now see four characters instead of two is the same as before. 
– The single UTF-8 character à (2 bytes) is displayed as the two characters à (still 2 bytes) when encoded asdecoded with Windows-1252. 
And the single UTF-8 character œ is displayed as the two Windows-1252 characters Å“.

Given that you want to display Ü and not the corrupted Ãœ, you need to : \

The file has now been converted back to its original state. 
What remains is to encodedecode it correctly (with UTF-8).

Yay! Mission accomplished.

To better understand the difference between decoding/encoding and converting a file, it might help to see how this is done in another versatile text editor: Notepad++. 
This helpful answer explains the difference in an instructive pictureinstructive picture :

  • An ASCII character uses just a single byte. 
    Or if you will, it uses seven of the eight bits of a byte – the most significant bit is always zero. 
    This corresponds to 0-127 in decimal numbers, 0x00-0x7F in hex numbers, 
    and 0000 0000 - 0111 1111 in bits.

  • Both ANSI/Windows-1252 and UTF-8 encode an ASCII character as the pure ASCII characterASCII character itself. 
    For example, the character (letter) k is a pure ASCII character. This is one byte (eight bits) which has the decimal number 107, the hex number is 0x6B, in bits 0110 1011. 
    As a consequence, it's wrong to say that the ASCII character k is not an ANSI character, nor that it's not a UTF-8 character. – It's both! 
    If a text file contains only ASCII characters, then the ANSI and UTF-8 encodings coincide. 
    You cannot tell one apart from the other. Such a file is both ANSI and UTF-8 encoded. 45

If you ever want to know how many bytes (and what bytes) a UTF-8 character uses,
you can try this online tool.

1 I think the scenario I present plausibly describes what might have happened.
Of course, I cannot know for sure what caused your situation.

2 To open settings.json, press Ctrl+ + , (comma), and then click the Open Settings icon in the top right corner :

Open Settings (JSON)

On macOS, use instead of Ctrl.

23 Some people would argue that the ANSI character set for Western Europe is ISO-8859-1The term “ANSI” as used to signify Windows code pages is a historical reference […]. 
My perception is that MicrosoftMicrosoft still uses ANSI for Western Europe interchangeably interchangeably with    Windows-1252,
at least for example in their notepad.exe text editor editor, typically located at C:\WINDOWS\System32. This is the convention I follow as well. See See also this answer.

34 To be more precise, each non-ASCII UTF-8 character uses at least two (up to four) bytes.

45 Suppose you have a text file containing only pure ASCII characters. If you open that file in some text editor, and the status bar says ANSI, that doesn't mean the file is not UTF-8 encoded. It just means that this text editor uses ANSI as its default encoding. If the default encoding were UTF-8, the editor would display UTF-8 in the status bar for the same file.

How can I stop the auto-change encoding?

By your description, the Auto Guess Encoding is already off.
The fact that VS Code still encodes your file as Windows-1252 (code page 1252) needs some other explanation.

I cannot know for sure what caused your situation.
But I've been able to reproduce it very accurately, and therefore think the scenario I present below plausibly describes what might have happened.

I will reproduce the essence of all your findings.
In doing so, I use a simplified version of your style.css file, containing just a single line :

To make VS Code open the file with encoding Windows-1252 (with Auto Guess Encoding off),
I will assume that the VS Code settings.json contains the following code/line : 1

Such a setting will make VS Code encode all .css files as Windows-1252
(also known as CP-1252 – the most common type of ANSI encoding). 2

The file SuperUser-Q1419830.zip contains the file style.css
(containing /* Ü */ encoded as UTF-8).
If you download and unzip it, then right-click style.css and Open with Code, expect to see :

The reason you see two Windows-1252 characters – Ãœ – instead of the single UTF-8 Ü character, is that Windows-1252 reads each byte as a single character – the non-ASCII characters à and œ.
UTF-8 on the other hand uses two bytes to read a single non-ASCII character like Ü. 3

1.A. How to display Ü correctly

To make the German letter Ü appear correctly, you need to click :
Reopen with Encoding > UTF-8 Guessed from content.

'Reopen with Encoding' changes how the file is encoded.

Choosing Reopen with Encoding doesn't change the file itself.
It changes how the file is displayed in VS Code – how it is encoded.

1.B. What you should not do

You'll get a problem if you instead click :
Save with Encoding > UTF-8 Guessed from content.

This does change the file – all non-ASCII characters get converted to their corresponding UTF-8 characters, and the file is saved with these changes.

The reason you now see four characters instead of two is the same as before.
– The single UTF-8 character à (2 bytes) is displayed as the two characters à (still 2 bytes) when encoded as Windows-1252.
And the single UTF-8 character œ is displayed as the two Windows-1252 characters Å“.

Given that you want to display Ü and not the corrupted Ãœ, you need to :

The file has now been converted back to its original state.
What remains is to encode it correctly (with UTF-8).

To better understand the difference between encoding and converting a file, it might help to see how this is done in another versatile text editor: Notepad++.
This answer explains the difference in an instructive picture :

  • An ASCII character uses just a single byte.
    Or if you will, it uses seven of the eight bits of a byte – the most significant bit is always zero.
    This corresponds to 0-127 in decimal numbers, 0x00-0x7F in hex numbers,
    and 0000 0000 - 0111 1111 in bits.

  • Both ANSI and UTF-8 encode an ASCII character as the pure ASCII character itself.
    For example, the character (letter) k is a pure ASCII character. This is one byte (eight bits) which has the decimal number 107, the hex number is 0x6B, in bits 0110 1011.
    As a consequence, it's wrong to say that the ASCII character k is not an ANSI character, nor that it's not a UTF-8 character. – It's both!
    If a text file contains only ASCII characters, then the ANSI and UTF-8 encodings coincide.
    You cannot tell one apart from the other. Such a file is both ANSI and UTF-8 encoded. 4

If you ever want to know how many bytes (and what bytes) a UTF-8 character uses,
you can try this online tool.

1 To open settings.json, press Ctrl+, (comma), and then click the Open Settings icon in the top right corner :

Open Settings (JSON)

On macOS, use instead of Ctrl.

2 Some people would argue that the ANSI character set for Western Europe is ISO-8859-1.
My perception is that Microsoft uses ANSI for Western Europe interchangeably with  Windows-1252,
at least in their notepad.exe text editor. This is the convention I follow. See also this answer.

3 To be more precise, each non-ASCII UTF-8 character uses at least two (up to four) bytes.

4 Suppose you have a text file containing only pure ASCII characters. If you open that file in some text editor, and the status bar says ANSI, that doesn't mean the file is not UTF-8 encoded. It just means that this text editor uses ANSI as its default encoding. If the default encoding were UTF-8, the editor would display UTF-8 in the status bar for the same file.

How can I stop the auto-change encoding?

According to your own comment, the Auto Guess Encoding is already off. 
The fact that VS Code encodes your file as Windows-1252 (code page 1252 or CP1252)
calls for some other explanation.

By assuming that you have a VS Code setting that specifically decodes your CSS files
as being Windows-1252, I've been able to reproduce your situation very accurately. 1

I use a simplified version of your style.css, containing just a single line :

To make VS Code open the file with encoding Windows-1252 (with Auto Guess Encoding off), 
I assume that the VS Code settings.json contains the following code/line : 2

Such a setting will make VS Code encode all .css files as Windows-1252. 3

If you download style.css, then right-click it and Open with Code, expect to see :

The reason you see two Windows-1252 characters – Ãœ – instead of the single UTF-8 Ü character, is that Windows-1252 reads each byte as a single character – the non-ASCII characters à and œ. 
UTF-8 on the other hand uses two bytes to read a single non-ASCII character like Ü. 4

1. a. How to display Ü correctly

To make the German letter Ü appear correctly, you need to click : 
Reopen with Encoding > UTF-8 Guessed from content.

'Reopen with Encoding' changes how the file is decoded.

Choosing Reopen with Encoding doesn't change the file itself. 
It changes how the file is displayed in VS Code – how it is decoded.

1. b. What you should not do

You'll get a problem if you instead click : 
Save with Encoding > UTF-8 Guessed from content.

This does change the file – all non-ASCII characters get converted to their corresponding UTF-8 characters. If you save the file, it is saved with these changes.

The reason you now see four characters instead of two is the same as before. 
– The single UTF-8 character à (2 bytes) is displayed as the two characters ��ƒ (still 2 bytes) when decoded with Windows-1252. 
And the single UTF-8 character œ is displayed as the two Windows-1252 characters Å“.

Given that you want to display Ü and not the corrupted Ãœ, you need to : \

The file has now been converted back to its original state. 
What remains is to decode it correctly (with UTF-8).

Yay! Mission accomplished.

To better understand the difference between decoding/encoding and converting a file, it might help to see how this is done in another versatile text editor: Notepad++. 
This helpful answer explains the difference in an instructive picture :

  • An ASCII character uses just a single byte. 
    Or if you will, it uses seven of the eight bits of a byte – the most significant bit is always zero. 
    This corresponds to 0-127 in decimal numbers, 0x00-0x7F in hex numbers, 
    and 0000 0000 - 0111 1111 in bits.

  • Both ANSI/Windows-1252 and UTF-8 encode an ASCII character as the ASCII character itself. 
    For example, the character (letter) k is a pure ASCII character. This is one byte (eight bits) which has the decimal number 107, the hex number is 0x6B, in bits 0110 1011. 
    As a consequence, it's wrong to say that the ASCII character k is not an ANSI character, nor that it's not a UTF-8 character. – It's both! 
    If a text file contains only ASCII characters, then the ANSI and UTF-8 encodings coincide. 
    You cannot tell one apart from the other. Such a file is both ANSI and UTF-8 encoded. 5

If you want to know how many bytes (and what bytes) a UTF-8 character uses, try this online tool.

1 I think the scenario I present plausibly describes what might have happened.
Of course, I cannot know for sure what caused your situation.

2 To open settings.json, press Ctrl + , (comma), and then click the Open Settings icon in the top right corner :

Open Settings (JSON)

On macOS, use instead of Ctrl.

3 The term “ANSI” as used to signify Windows code pages is a historical reference […]. 
Microsoft still uses ANSI for Western Europe interchangeably with  Windows-1252, for example in their notepad.exe text editor, typically located at C:\WINDOWS\System32. This is the convention I follow as well. See also this answer.

4 To be more precise, each non-ASCII UTF-8 character uses at least two (up to four) bytes.

5 Suppose you have a text file containing only pure ASCII characters. If you open that file in some text editor, and the status bar says ANSI, that doesn't mean the file is not UTF-8 encoded. It just means that this text editor uses ANSI as its default encoding. If the default encoding were UTF-8, the editor would display UTF-8 in the status bar for the same file.

Main edit: added Section 2 on how to restore the corrupted file.
Source Link

To make VS Code open the file with encoding Windows-1252
  (even though thewith Auto Guess Encoding is offoff),
I will assume that the VS Code settings.json contains the following code/line : 1

The file SuperUser-q1419830.zipSuperUser-Q1419830.zip contains the file style.css
(containing /* Ü */ encoded as UTF-8).
If you download and unzip it, then right-click style.css and Open with Code, expect to see :

The reason you see two CP-1252Windows-1252 characters – Ãœ – instead of the of the single UTF-8UTF-8 Ü character, is that CP-1252 Windows-1252 reads each byte as a a single character – the non-ASCII characters    à and œ. 
UTF-8UTF-8 on the other hand uses two bytes to read a single non non-ASCII character character like Ü. 3

When you now close and reopen style.css,
  it will once again be encoded as Windows-1252/CP-1252.
(Why? – Because that's exactly what the line "[css]": {"files.encoding": "windows1252"}, in settings.json is telling VS Code!)

Note how Ü are the same characters that areas those displayed in the screenshot of your question.

The reason you now see four characters instead of two is the same as before. 
– The single UTF-8UTF-8 character à (2 bytes) is displayed as the    two characters characters à (still 2 bytes) when encoded as CP-1252 Windows-1252.
And the single UTF-8UTF-8 character œ is displayed as the two CP-1252 charactersWindows-1252 characters Å“.

2. Encoding vs converting in Notepad++How to repair the corrupted file

Given that you want to display Ü and not the corrupted Ãœ, you need to :

  1. convert the file back,
  2. encode with UTF-8,
  3. close and reopen the file.

1. Convert the file back

Here is how to convert the corrupted style.css back to its original state.
Starting from the previous screenshot, in the status bar, click Windows 1252,
then Reopen with Encoding, and finally UTF-8.

Windows 1252 > Reopen with Encoding > UTF-8.

Expect to see Ü. The file is still corrupted, so now convert it to Windows-1252 by clicking :
UTF-8 > Save with Encoding > Windows 1252.

UTF-8 > Save with Encoding > Windows 1252.

The file has now been converted back to its original state.
What remains is to encode it correctly (with UTF-8).

2. Encode with UTF-8

In settings.json, delete "[css]": {"files.encoding": "windows1252"},.

3. Close and reopen the file

Close and reopen style.css. Check that you see UTF-8 in the status bar. Expect to see :

The corrupted file has been restored.

3. Encoding vs converting in Notepad++

34. ASCII, ANSI, and UTF-8

A few facts may help to understandthe understanding of what ASCII, ANSI, and UTF-8 are.

  • An ASCII character uses just a single byte.
    Or if you will, it uses seven of the eight bits of a byte – as the most significant bit is always zero.
    This corresponds to 0-127 in decimal numbers, 00 0x00-7F0x7F in hex numbers, 
    and 0000 0000 - 0111 1111 in bits.

  • Both ANSI and UTF-8 encode an ASCII character as the pure ASCII character itself.
    For example, the character (letter) k is a pure ASCII character. This is one byte (eight bits) which has the decimal number 107, the hex number is 6B0x6B, in bits 0110 1011. 
    As a consequence, it's wrong to say that the ASCII character k is not an ANSI character, nor that it's not a UTF-8 character. – It's both!
    If a text file contains only ASCII characters, then the ANSI and UTF-8 encodings coincide.
    You cannot tell one apart from the other. Such a file is both ANSI and UTF-8 encoded. 4

The upper half of the Windows-1252 table above corresponds to numbers 0-127, and the lower half corresponds to numbers 128-255. ThoseThe latter are the non-ASCII ANSI characters of CPWindows-1252.

The picture below is taken from UTF-8 and ASCII character charts, 
and displays all those Windows-1252 characters once more, numbered 128-255.

If you ever want to know how many bytes (and what bytes) a UTF-8 character uses, you
you can try this online tool.

1 To open settings.json, press Ctrl+, (comma), and then click the Open Settings icon in the top right corner :

Open Settings (JSON)

On macOS, use instead of Ctrl.

2 Some people would argue that the ANSI character set for Western Europe is ISO-8859-1.
My perception is that Microsoft uses ANSI for Western Europe interchangeably with Windows-1252,
at least in their notepad.exe text editor. This is the convention I follow. See also this answer.

3 To be more precise, each non-ASCII UTF-8 character uses up at least two (up to four) bytes.

4 Suppose you have a text file containing only pure ASCII characters. If you open that file in some text editor, and the status bar says ANSI, that doesn't mean the file is not UTF-8 encoded. It just means that this text editor uses ANSI as its default encoding. If the default encoding were UTF-8, the editor would display UTF-8 in the status bar for the same file.

To make VS Code open the file with encoding Windows-1252
  (even though the Auto Guess Encoding is off),
I will assume that the VS Code settings.json contains the following code/line : 1

The file SuperUser-q1419830.zip contains the file style.css
(containing /* Ü */ encoded as UTF-8).
If you download and unzip it, then right-click style.css and Open with Code, expect to see :

The reason you see two CP-1252 characters – Ãœ – instead of the single UTF-8 Ü character, is that CP-1252 reads each byte as a single character – the non-ASCII characters  Ã and œ. UTF-8 on the other hand uses two bytes to read a single non-ASCII character like Ü. 3

When you now close and reopen style.css,
  it will once again be encoded as Windows-1252/CP-1252.
(Why? – Because that's exactly what the line "[css]": {"files.encoding": "windows1252"}, in settings.json is telling VS Code!)

Note how Ü are the same characters that are displayed in the screenshot of your question.

The reason you now see four characters instead of two is the same as before. – The single UTF-8 character à (2 bytes) is displayed as the  two characters à (still 2 bytes) when encoded as CP-1252.
And the single UTF-8 character œ is displayed as the two CP-1252 characters Å“.

2. Encoding vs converting in Notepad++

3. ASCII, ANSI, and UTF-8

A few facts may help to understand what ASCII, ANSI, and UTF-8 are.

  • An ASCII character uses just a single byte.
    Or if you will, it uses seven of the eight bits of a byte – as the most significant bit is always zero.
    This corresponds to 0-127 in decimal numbers, 00-7F in hex numbers, and 0000 0000 - 0111 1111 in bits.

  • Both ANSI and UTF-8 encode an ASCII character as the pure ASCII character itself.
    For example, the character (letter) k is a pure ASCII character. This is one byte (eight bits) which has the decimal number 107, the hex number is 6B, in bits 0110 1011. As a consequence, it's wrong to say that the ASCII character k is not an ANSI character, nor that it's not a UTF-8 character. – It's both!
    If a text file contains only ASCII characters, then the ANSI and UTF-8 encodings coincide.
    You cannot tell one apart from the other. Such a file is both ANSI and UTF-8 encoded. 4

The upper half of the Windows-1252 table above corresponds to numbers 0-127, and the lower half corresponds to numbers 128-255. Those are the non-ASCII ANSI characters of CP-1252.

The picture below is taken from UTF-8 and ASCII character charts, and displays all those Windows-1252 characters once more, numbered 128-255.

If you ever want to know how many bytes (and what bytes) a UTF-8 character uses, you can try this online tool.

1 To open settings.json, press Ctrl+, (comma), and then click the Open Settings icon in the top right corner :

Open Settings (JSON)

On macOS, use instead of Ctrl.

2 Some people would argue that the ANSI character set for Western Europe is ISO-8859-1.
My perception is that Microsoft uses ANSI for Western Europe interchangeably with Windows-1252,
at least in their notepad.exe text editor. This is the convention I follow.

3 To be more precise, each non-ASCII UTF-8 character uses up at least two (up to four) bytes.

4 Suppose you have a text file containing only pure ASCII characters. If you open that file in some text editor, and the status bar says ANSI, that doesn't mean the file is not UTF-8 encoded. It just means that this text editor uses ANSI as its default encoding. If the default encoding were UTF-8, the editor would display UTF-8 in the status bar for the same file.

To make VS Code open the file with encoding Windows-1252 (with Auto Guess Encoding off),
I will assume that the VS Code settings.json contains the following code/line : 1

The file SuperUser-Q1419830.zip contains the file style.css
(containing /* Ü */ encoded as UTF-8).
If you download and unzip it, then right-click style.css and Open with Code, expect to see :

The reason you see two Windows-1252 characters – Ãœ – instead of the single UTF-8 Ü character, is that Windows-1252 reads each byte as a single character – the non-ASCII characters  à and œ. 
UTF-8 on the other hand uses two bytes to read a single non-ASCII character like Ü. 3

When you now close and reopen style.css, it will again be encoded as Windows-1252.
(Why? – Because that's exactly what the line "[css]": {"files.encoding": "windows1252"}, in settings.json is telling VS Code!)

Note how Ü are the same characters as those displayed in the screenshot of your question.

The reason you now see four characters instead of two is the same as before. 
– The single UTF-8 character à (2 bytes) is displayed as the  two characters à (still 2 bytes) when encoded as Windows-1252.
And the single UTF-8 character œ is displayed as the two Windows-1252 characters Å“.

2. How to repair the corrupted file

Given that you want to display Ü and not the corrupted Ãœ, you need to :

  1. convert the file back,
  2. encode with UTF-8,
  3. close and reopen the file.

1. Convert the file back

Here is how to convert the corrupted style.css back to its original state.
Starting from the previous screenshot, in the status bar, click Windows 1252,
then Reopen with Encoding, and finally UTF-8.

Windows 1252 > Reopen with Encoding > UTF-8.

Expect to see Ü. The file is still corrupted, so now convert it to Windows-1252 by clicking :
UTF-8 > Save with Encoding > Windows 1252.

UTF-8 > Save with Encoding > Windows 1252.

The file has now been converted back to its original state.
What remains is to encode it correctly (with UTF-8).

2. Encode with UTF-8

In settings.json, delete "[css]": {"files.encoding": "windows1252"},.

3. Close and reopen the file

Close and reopen style.css. Check that you see UTF-8 in the status bar. Expect to see :

The corrupted file has been restored.

3. Encoding vs converting in Notepad++

4. ASCII, ANSI, and UTF-8

A few facts may help the understanding of what ASCII, ANSI, and UTF-8 are.

  • An ASCII character uses just a single byte.
    Or if you will, it uses seven of the eight bits of a byte – the most significant bit is always zero.
    This corresponds to 0-127 in decimal numbers, 0x00-0x7F in hex numbers, 
    and 0000 0000 - 0111 1111 in bits.

  • Both ANSI and UTF-8 encode an ASCII character as the pure ASCII character itself.
    For example, the character (letter) k is a pure ASCII character. This is one byte (eight bits) which has the decimal number 107, the hex number is 0x6B, in bits 0110 1011. 
    As a consequence, it's wrong to say that the ASCII character k is not an ANSI character, nor that it's not a UTF-8 character. – It's both!
    If a text file contains only ASCII characters, then the ANSI and UTF-8 encodings coincide.
    You cannot tell one apart from the other. Such a file is both ANSI and UTF-8 encoded. 4

The upper half of the Windows-1252 table above corresponds to numbers 0-127, and the lower half to numbers 128-255. The latter are the non-ASCII ANSI characters of Windows-1252.

The picture below is taken from UTF-8 and ASCII character charts, 
and displays all those Windows-1252 characters once more, numbered 128-255.

If you ever want to know how many bytes (and what bytes) a UTF-8 character uses,
you can try this online tool.

1 To open settings.json, press Ctrl+, (comma), and then click the Open Settings icon in the top right corner :

Open Settings (JSON)

On macOS, use instead of Ctrl.

2 Some people would argue that the ANSI character set for Western Europe is ISO-8859-1.
My perception is that Microsoft uses ANSI for Western Europe interchangeably with Windows-1252,
at least in their notepad.exe text editor. This is the convention I follow. See also this answer.

3 To be more precise, each non-ASCII UTF-8 character uses at least two (up to four) bytes.

4 Suppose you have a text file containing only pure ASCII characters. If you open that file in some text editor, and the status bar says ANSI, that doesn't mean the file is not UTF-8 encoded. It just means that this text editor uses ANSI as its default encoding. If the default encoding were UTF-8, the editor would display UTF-8 in the status bar for the same file.

Source Link

How can I stop the auto-change encoding?

– By your description, the Auto Guess Encoding is already off.
The fact that VS Code still encodes your file as Windows-1252 (code page 1252) needs some other explanation.

I cannot know for sure what caused your situation.
But I've been able to reproduce it very accurately, and therefore think the scenario I present below plausibly describes what might have happened.

1. Reproducing the whole scenario

I will reproduce the essence of all your findings.
In doing so, I use a simplified version of your style.css file, containing just a single line :

/* Ü */

To make VS Code open the file with encoding Windows-1252
(even though the Auto Guess Encoding is off),
I will assume that the VS Code settings.json contains the following code/line : 1

"[css]": {"files.encoding": "windows1252"},

Such a setting will make VS Code encode all .css files as Windows-1252
(also known as CP-1252 – the most common type of ANSI encoding). 2

The file SuperUser-q1419830.zip contains the file style.css
(containing /* Ü */ encoded as UTF-8).
If you download and unzip it, then right-click style.css and Open with Code, expect to see :

With encoding Windows-1252, Ü is shown as Ãœ.

^ click to enlarge

The reason you see two CP-1252 characters – Ãœ – instead of the single UTF-8 Ü character, is that CP-1252 reads each byte as a single character – the non-ASCII characters à and œ. UTF-8 on the other hand uses two bytes to read a single non-ASCII character like Ü. 3

1.A. How to display Ü correctly

To make the German letter Ü appear correctly, you need to click :
Reopen with Encoding > UTF-8 Guessed from content.

'Reopen with Encoding' changes how the file is encoded.

Choosing Reopen with Encoding doesn't change the file itself.
It changes how the file is displayed in VS Code – how it is encoded.

1.B. What you should not do

You'll get a problem if you instead click :
Save with Encoding > UTF-8 Guessed from content.

Save with Encoding > **UTF-8 changes the file itself.

This does change the file – all non-ASCII characters get converted to their corresponding UTF-8 characters, and the file is saved with these changes.

When you now close and reopen style.css,
it will once again be encoded as Windows-1252/CP-1252.
(Why? – Because that's exactly what the line "[css]": {"files.encoding": "windows1252"}, in settings.json is telling VS Code!)

Here is what you'll see.

Save with Encoding > **UTF-8 changes the file itself.

Note how Ü are the same characters that are displayed in the screenshot of your question.

The reason you now see four characters instead of two is the same as before. – The single UTF-8 character à (2 bytes) is displayed as the two characters à (still 2 bytes) when encoded as CP-1252.
And the single UTF-8 character œ is displayed as the two CP-1252 characters Å“.

This completes my reproduction of your scenario.

2. Encoding vs converting in Notepad++

To better understand the difference between encoding and converting a file, it might help to see how this is done in another versatile text editor: Notepad++.
This answer explains the difference in an instructive picture :

The difference between Encoding and Converting in Notepad++.

Encoding in Notepad++ corresponds to Reopen with Encoding in VS Code, whereas
Converting in Notepad++ corresponds to Save with Encoding in VS Code.

3. ASCII, ANSI, and UTF-8

A few facts may help to understand what ASCII, ANSI, and UTF-8 are.

  • An ASCII character uses just a single byte.
    Or if you will, it uses seven of the eight bits of a byte – as the most significant bit is always zero.
    This corresponds to 0-127 in decimal numbers, 00-7F in hex numbers, and 0000 0000 - 0111 1111 in bits.

  • Both ANSI and UTF-8 encode an ASCII character as the pure ASCII character itself.
    For example, the character (letter) k is a pure ASCII character. This is one byte (eight bits) which has the decimal number 107, the hex number is 6B, in bits 0110 1011. As a consequence, it's wrong to say that the ASCII character k is not an ANSI character, nor that it's not a UTF-8 character. – It's both!
    If a text file contains only ASCII characters, then the ANSI and UTF-8 encodings coincide.
    You cannot tell one apart from the other. Such a file is both ANSI and UTF-8 encoded. 4

The windows-1252 (CP-1252) encoding table.

^ click to enlarge

The upper half of the Windows-1252 table above corresponds to numbers 0-127, and the lower half corresponds to numbers 128-255. Those are the non-ASCII ANSI characters of CP-1252.


The picture below is taken from UTF-8 and ASCII character charts, and displays all those Windows-1252 characters once more, numbered 128-255.

The windows-1252 (CP-1252) non-ASCII characters.


If you ever want to know how many bytes (and what bytes) a UTF-8 character uses, you can try this online tool.

References


1 To open settings.json, press Ctrl+, (comma), and then click the Open Settings icon in the top right corner :

Open Settings (JSON)

On macOS, use instead of Ctrl.

2 Some people would argue that the ANSI character set for Western Europe is ISO-8859-1.
My perception is that Microsoft uses ANSI for Western Europe interchangeably with Windows-1252,
at least in their notepad.exe text editor. This is the convention I follow.

3 To be more precise, each non-ASCII UTF-8 character uses up at least two (up to four) bytes.

4 Suppose you have a text file containing only pure ASCII characters. If you open that file in some text editor, and the status bar says ANSI, that doesn't mean the file is not UTF-8 encoded. It just means that this text editor uses ANSI as its default encoding. If the default encoding were UTF-8, the editor would display UTF-8 in the status bar for the same file.