Illegal character: 5279 solution appears in Java code compilation

Source: Internet
Author: User


During code compilation today, the following error occurs unexpectedly:

Illegal character: 5279

The file is UTF-8-encoded and should not be wrong.

So I went to the internet to check the information, found that there are two types of UTF-8 encoding:

UTF-8-BOM coding and UTF-8 without BOM coding

Two types of encoding may be suspected.

Due to the error message that the first character of the file is located, it is suspected that the file may contain a BOM mark.


The specific reasons are as follows:


Some editors add the utf8 mark to the utf8 file (editplus calls it a signature). It inserts three invisible characters (0xEF 0xBB 0xBF, or BOM) at the beginning of the file ), it represents the Unicode mark (BOM ). To solve this problem, use editplus to open the File and select Permanet Settings from the Doucument menu. There are three categories: General, File, and Tools. click File, there is a UTF-8 signature on the right: Select always remove signature. click OK. The menu structure of operations under Editplus is as follows: document-> Parameter Settings-> File-> UTF-8 signature-> always remove signature-> OK, this sets the UTF-8 format does not need to add a mark in front of the file, and finally save the file as UTF-8 format.

Solution

Open Notapad ++, import the file, and execute "format (M)-> convert to UTF-8 without BOM encoding format"

Save and exit.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.