Error message in intellij idea: Java: syntax error on token "invalid character", delete this token
Error message in intellij idea: "invalid character: \ 65279"
An error occurred while importing a project in myeclipse to intellij idea.
Method 1 provided in this article is successfully used in intellij idea 10, but failed to use in intellij idea 12. In intellij idea 12, you have to use the more troublesome method 2 to succeed.
I. Problem description:
Import the project code created in eclipse to intellij idea and find Chinese garbled characters. Use the tool to convert the source file encoding to "UTF-8", the display is normal, but after modifying the file, "invalid character: \ 65279" appears during compilation ".
Ii. cause:
Intellij idea automatically adds a UTF-8 file signature to a file that is set to "UTF-8" encoded when it is modified and saved after modification, that is, BOM (view the file in hexadecimal form, the first part of the file is "Ef bb bf ").
Iii. solution:
(1) Use the eclipse compiler for compilation. The setting method in intellij idea 10.0 is settings (CTRL + ALT + S) -> Project setting-> compiler-> JAVA complier-> Use complier select eclipse and click OK
(2) use Notepad ++ to remove BOM [IN intellij idea 12, successful]
Specific Method: first set to UTF-8 without ROM encoding, and then open the file, save this file, overwrite the original file.
Setup method: format-> encoded as UTF-8 without ROM.
When using intellij idea 12, you can first try the first method. If it fails, then use the second method.