如何设置Visual Studio Code在打开文件时检测并设置正确的编码 [英] How to setup Visual Studio Code detect and set correct encoding on file open

查看:215
本文介绍了如何设置Visual Studio Code在打开文件时检测并设置正确的编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始在未安装Studio IDE的服务器系统上使用Visual Studio Code。我非常喜欢,但是遇到了问题。
当我打开文件(之前使用Notepad ++)时,编辑器会检测编码并为我设置。 Windows服务器上仍有许多文件,其中 windows-1252 仍然可用,但 vscode 只需使用 UTF-8 默认情况。



我知道我可以用Western编码重新打开(Win​​dows 1252)但是我经常忘记它,有时会破坏一些内容来保存它。



所以我还没有找到任何参数,有没有办法使 vscode 是否检测编码并在我打开文件时自动设置它?

解决方案

允许Visual Studio代码要自动检测文件的编码,可以设置 files.autoGuessEncoding:true (在 settings.json 配置文件)。



https:/ /github.com/Microsoft/vscode/pull/21416



与最初提出问题的时间相比,这显然需要更新应用程序的版本。 / p>

I recently started to use Visual Studio Code on Server Systems where I did not have Studio IDE installed. I like it very much but run into a problem. When I open a file (used Notepad++ before) the editor detect encoding and set it for me. Have many files on windows servers with windows-1252 still but vscode just use UTF-8 by default.

I know I can reopen with encoding Western (Windows 1252) but I forgot it often and I sometimes destroyed some content saving it.

So I did not find any parameter yet, is there a way to make vscode detect encoding and set it automatically when I open a file?

解决方案

To allow Visual Studio Code to automatically detect the encoding of a file, you can set "files.autoGuessEncoding":true (in the settings.json configuration file).

https://github.com/Microsoft/vscode/pull/21416

This obviously requires an updated verison of the application compared to when the question was originally asked.

这篇关于如何设置Visual Studio Code在打开文件时检测并设置正确的编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆