hanki.dev

Easily change file encoding with VSCode

Encoding problems are the kind of problems which make you wanna quit your job. Luckily I found (thanks to my brother) a way to easily change file encoding, without breaking special characters. Below is example how I changed windows-1252 encoding to UTF-8.

  1. Open the file in VSCode
    • β€’ By default VSCode opens files with UTF-8
    • β€’ You can see this by the 'UTF-8' text from bottom right corner
    • β€’ Also special characters, such as 'Γ€' and 'ΓΆ' should be seen as question marks
  2. Command palette β†’ Change file encoding β†’ Reopen with encoding β†’ windows-1252
  3. Now you should see the special characters normally
  4. Command palette β†’ Change file encoding β†’ Save with encoding β†’ UTF-8
  5. Save the file and be happy once again

There a lots of ways to change file encoding but I found that most of them can't preserve special character 😐

#vscode