The encoding of java resources are all utf8, and they are compiled using utf8. However, when outputting from the console, Chinese characters will still appear garbled.
eclipse console
The encoding of the eclipse console defaults to the encoding of the operating system, such as GBK. At this time, utf8-encoded Chinese characters cannot be displayed correctly, and the encoding of the console needs to be specified as utf8. Steps:
Menu: Run Configuration | Console Encoding of Common tab on the right select UTF-8 encoding
cmd console
The encoding of the cmd console defaults to the encoding of the operating system, such as GBK. Same as above, there will be problems when displaying Chinese characters. You can set it like this:
Open cmd.exe
Execute chcp 65001 to change the code page. 65001 is UTF-8 and 936 is Chinese characters.
Specify the encoding java -Dfile.encoding=UTF-8 when executing the java command xxx
For more java related articles, please pay attention to the java basic tutorial column.
The above is the detailed content of Solution to Java console output garbled code. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Dreamweaver Mac version
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SublimeText3 Chinese version
Chinese version, very easy to use

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
