java: Illegal character: '\ufeff'

Problem Description

When the Java project is compiled and run, the following information is prompted:

java: 非法字符: '\ufeff'

Or other prompts containing "0xfeff" are all caused by a problem, which is caused by creating or storing files in BOM mode.

Similar errors are also:

Unexpected character 0xfeff in identifier

solve

Regarding BOM, it is a binary storage format, which is a question of whether the high-order binary is first or last, and it is enough to understand a little bit.

When we actually develop, we need to use the NO BOM method.

In the above situation, find the corresponding file, click "Remove BOM" in the lower right corner of the idea
insert image description here
. In addition, the format of the project should also be set to "With NO BOM":

insert image description here

Guess you like

Origin blog.csdn.net/weixin_29003023/article/details/127420001