Tag Archives: Illegal character error

Error: (1, 1) java: Illegal character:’\ufeff’ [How to Solve]

the problem

When opening the eclipse java project compiling with IDEA, the following error occurred:

Error:(1, 1) java: Illegal character: ‘\ufeff’ 
Error:(1, 10) java: need class, interface or enum 

2. Reason analysis

Eclipse can intelligently convert UTF-8+BOM files into ordinary UTF-8 files. IDEA does not have this intelligent conversion.

Three, the solution

1 Convert with IDEA, first convert to GBK, and then back to UTF-8



2 Convert with other editors, such as notpade++, sublime, etc.

The principle is the same, the operation is omitted.