"UTF8 characters encoded in encoding" occurs when you compile with ant, because the encoding is not the same as the encoding of the file store.

Source: Internet
Author: User
"UTF8 characters encoded in encoding" occurs when you compile with ant, because the encoding is not the same as the encoding of the file store.

If the ant build file writes <?xml version= "1.0" encoding= "UTF-8", then ant compiles the source file in UTF-8 encoding if the source file is
Encoded with GBK, the "unmapped character of encoded UTF8" appears, and the solution is:
<javac srcdir= "src" destdir= "build/classes" >
<compilerarg line= "-encoding GBK"/>
</javac>
The above statement tells Ant to compile the source file with GBK encoding

Another solution is to change the source file to UTF-8 encoding, with Notepad Save as ..., and then select UTF-8, resulting in an error
D:\workspaces\anttest\src\com\shengsiyuan\ant\custom\applicationexception.java:1: illegal character: \65279
The reason is that some editors add a UTF8 tag (editplus called it a signature) to the UTF8 file, which inserts three invisible characters (0xEF 0xBB 0xBF, or BOM) at the beginning of the file, representing the Unicode mark (BOM).
So the key to solving this problem is to remove the tag option.
If you create a new file in MyEclipse, and then use UTF-8 encoding, this problem does not occur (no UTF-8 marked BOM), so if you want to turn the code on the MyEclipse


If the ant build file writes <?xml version= "1.0" encoding= "GBK", then ant compiles the source file in GBK encoding if the source file is
Encoded with UTF-8, the "unmapped characters of encoded GBK" will appear, and the workaround:
<javac srcdir= "src" destdir= "build/classes" >
<compilerarg line= "-encoding UTF-8"/>
</javac>
The above statement tells Ant to compile the source file with UTF-8 encoding

Another solution is to change the source file to GBK encoding, if you want to turn the code in the MyEclipse

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.