Home >Java >JavaBase >How to solve Chinese garbled characters in Java?

How to solve Chinese garbled characters in Java?

尚
Original
2019-11-19 13:31:45109050browse

How to solve Chinese garbled characters in Java?

Solution to Chinese garbled characters in java:

1. Set the encoding of the workspace

1. The encoding of the editor It will affect the display of characters in all projects. It can be said to be the most widespread setting. Every project will be affected by this setting. Click Window - Preferences in the menu bar.

2. Click General - Wordspace, and then select the encoding format you want to set in the Text file encoding format on the right. The system default format is GBK.

2. Set the encoding of the project

1. If there is no garbled code problem in other projects, but only some garbled codes appear when displaying, then we do not need to set up the work. For the encoding of the space, you only need to modify the encoding of the project.

2. After selecting the item, right-click and click Properties in the pop-up menu.

3. In the pop-up properties window, select Resource - click to select Other, and then select the encoding format you want.

3. Set the encoding of a single file

1. Only some files are garbled, so setting the encoding format of individual files can solve the problem. Select the garbled file and right-click.

2. Select Properties in the pop-up menu.

3. Select the resource in the pop-up properties window, click Other and set the encoding method of individual files.

For more java knowledge, please pay attention to java basic tutorial.

The above is the detailed content of How to solve Chinese garbled characters in Java?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn