UTF-8 without BOM

2018-12-31 19:20发布

I have javascript files that I need them to be saved in UTF-8 (without BOM), every time I convert them to the correct format in Notepad++, they are reverted back to UTF-8 with BOM when I open them in Visual Studio. How can I stop VS2010 from doing that?

Another question, is UTF-8 without signature in Visual Studio the same as UTF-8 without BOM?

8条回答
弹指情弦暗扣
2楼-- · 2018-12-31 19:41

For vs2010 c++, there will be problems with UTF8 without BOM, when source files contain multi-byte characters(eg. Chinese).

Those characters will not be recognized correctly without BOM, and result in failed compling.

查看更多
时光乱了年华
3楼-- · 2018-12-31 19:43

Recently I found this tiny command-line tool which adds or removes the BOM on arbitary UTF-8 encoded files: UTF BOM Utils (new link at github)

Little drawback, you can download only the plain C++ source code. You have to create the makefile (with CMake, for example) and compile it by yourself, binaries are not provided on this page. However, for a software developer this should not be any issue.

查看更多
登录 后发表回答