Drag the Java file in Idea to the local computer and run it in cmd. An error occurs: Unmappable characters in GBK encoding. Reason

Table of contents

Problem: After dragging the Java file in Idea to the local computer, an error occurs when running cmd: Unmappable characters are encoded in GBK, and the encoding of the file in Idea is shown to be utf-8.

Reason: I don’t know if Idea automatically converted the file to GBK mode.

Solution: At runtime, add encoding -encoding utf-8 at the end


Problem: After dragging the Java file in Idea to the local computer, an error occurs when running cmd: Unmappable characters are encoded in GBK, and the encoding of the file in Idea is shown to be utf-8.

Check the settings and find that Idea is all utf-8.

Reason: I don’t know if Idea automatically converted the file to GBK mode.

Solution: Add encoding at runtime -encoding utf-8

This solves the problem, although the cause is still not clear. I checked a lot but can't figure out what the problem is. It hurts, it hurts too much.

Guess you like

Origin blog.csdn.net/m0_61059796/article/details/134133835