Visual Studio Code: setting file encoding by folder
Asked Answered
S

1

8

In Visual Studio Code (Community version 1.17.2), I have configured file encoding in my Working Settings (settings.json) like that:

"files.encoding": "utf8"

Nevertheless, inside a specific folder in my Working Space, I need to have some scripts with iso88591 encoding. Could I specify a encoding in a specific folder DIFFERENT from that specified in my Working Settings?

Systematist answered 13/11, 2017 at 12:25 Comment(1)
To rephrase the question, are there per-folder settings and do they include the files.encoding setting?Whitethroat
G
2

It is possible to set the default file encoding for a VSCode workspace. So open the specific folder in VSCode (this automatically creates a workspace), then go to Preferences -> Settings -> Workspace, and set files.encoding: iso88591. I haven't found a way to have two different encodings in the same workspace, so this might not be quite the solution you were hoping for. For this solution to work you would have to open the folder with the other encoding in a separate VSCode window. But I guess this is as close as you can get. (The other options as of today are setting the file encoding by file type, or use autoGuessEncoding).

Getty answered 1/12, 2023 at 15:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.