Java prompt unmappable character for encoding solution

We Java developers may often encounter unmappable Character for Encoding errors. The reason for this error is that the source code contains characters not included in the GBK encoding. The solution: The source code contains characters not included in the GBK encoding.

• delete the character
• save the source code file as utf-8 encoding

unmappable character for encoding error. However, after looking it up on the Internet, we know that the class file of Java USES utf-8 encoding. Test2.java is compiled to Test2.class, including the utF-8 encoding conversion process.

solution

0

1

2

copy code copy code
compile javac-encoding GBK test2. Java runs java-dfile.encoding = “GBK” test2

3

Read More: