Compilation error: java illegal character \ufeff, setting Create UTF-8 Files with BOM problem

During the development process, I encountered a very strange problem. I don’t know whether it was because I changed the default attribute encoding in the settings or copied other codes. It was also a great experience.
You should pay attention to whether there are problems with several files. This error will only remind one file. After the modification is completed, start the project to see if the error is still reported for that file. .
Insert image description here

Solution

First check Settings->Compiler->File Encoding

The Chinese Language Pack plug-in is used here, so the display is in Chinese. First, the BOM is set to not include BOM.
Insert image description here

method one

The simplest and crudest method is to find the price of the error report after the BOM is set, first copy the file content, then delete the file, create a new one and paste it. (This method is not recommended if the file is garbled)

Method 2 idea

Enter the error page, click File->File Properties->File Encoding in the upper left corner

Insert image description here

Click more and find UTF-8 click

Insert image description here

Click Convert. If the garbled code is garbled, you can click Reload (here is a demonstration, so the picture shows UTF-16, so select UTF-8)

Insert image description here
That's it. If you still get an error after restarting the project, please check if there are other errors in asking for prices. If you still get an error with this file, please refer to method three.

Method three notpad++

Use this tool to open files for encoding.
Insert image description here
For the download address, please refer to ProYuan28’s works.

This is the end of sharing.
Xiaobai has a long road ahead, let’s work hard together! ! ! !

Guess you like

Origin blog.csdn.net/weixin_52473844/article/details/135292278