似乎 Visual Studio 2017 总是将新文件保存为 UTF8-BOM.早期版本的 Visual Studio 似乎也不是这种情况,但我找不到任何文档.
还有一个选项高级保存选项编码";这确实允许更改 VS2017 中缺少的新保存文件的编码.
问题:
还有一个选项高级保存选项编码"确实允许更改丢失的新保存文件的编码在 VS2017 中.
<块引用>
VS2017中所有文件类型都是用UTF8-BOM编码保存的吗
在我的例子中,VS 使用 CodePage 1252 编码存储所有文件.
<块引用>是否可以在VS2017中为新文件配置编码
但是,我的 Visual Studio 版本是 15.6.1,有些人在 2017 年以前的版本中遇到了和你一样的问题,但是 他们说 "我们已经解决了这个问题,它在 Visual Studio 2017 15.3 中可用"
如果不工作,对于 C++ 项目请查看 /utf-8(将源和可执行字符集设置为 UTF-8).
<块引用>VS2017 会改变旧"文件的编码吗?UTF8-BOM
默认情况下,Visual Studio 会检测字节顺序标记以确定源文件是否采用编码的 Unicode 格式,例如 UTF-16 或 UTF-8.如果未找到字节顺序标记,则假定源文件使用当前用户代码页进行编码,除非您使用/utf-8 或/source-charset 选项指定了代码页.有些人遇到了问题,它来自.editorconfig 文件,如下:
root = true[*]indent_style = 制表符缩进大小 = 4tab_width = 4trim_trailing_whitespace = trueinsert_final_newline = 真字符集 = utf-8
最后的 charset 行很可能会这样做...但我不是要'utf-8-with-bom'!
It seems Visual Studio 2017 always saves new files as UTF8-BOM. It also seems this was not the case with earlier versions of Visual Studio, but I could not find any documentation.
Also there has been an option "Advanced Save OptionsEncoding" which did allow to change the encoding of newly saved files which is missing in VS2017.
Questions:
Also there has been an option "Advanced Save OptionsEncoding" which did allow to change the encoding of newly saved files which is missing in VS2017.
This feature Already exists! You can save files with specific character encoding to support bi-directional languages. You can also specify an encoding when opening a file, so that Visual Studio displays the file correctly.
Are all files types saved with UTF8-BOM encoding in VS2017
In my case, VS stores all the files with CodePage 1252 encoding.
Is it possible to configure the encoding for new files in VS2017
However, My Visual Studio version is 15.6.1 and some people have the same problem like yours in previous versions of 2017, but they said "We have fixed this issue and it's available in Visual Studio 2017 15.3"
If not working, for C++ projects Take a look at /utf-8 (Set Source and Executable character sets to UTF-8).
Will VS2017 change the encoding of "old" files which don't have UTF8-BOM
By default, Visual Studio detects a byte-order mark to determine if the source file is in an encoded Unicode format, for example, UTF-16 or UTF-8. If no byte-order mark is found, it assumes the source file is encoded using the current user code page, unless you have specified a code page by using /utf-8 or the /source-charset option. Some people encountered a problem which is came from .editorconfig file, as below:
root = true
[*]
indent_style = tab
indent_size = 4
tab_width = 4
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8
That final charset line is probable doing it... but I'm not asking for 'utf-8-with-bom'!
这篇关于Visual Studio 2017 中源文件的默认编码是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!