Home  >  Article  >  Backend Development  >  Some explanations on the garbled code problem in eclipse

Some explanations on the garbled code problem in eclipse

巴扎黑
巴扎黑Original
2017-07-22 10:43:091033browse

The Eclipse console must be encoded in GBK. Therefore, condition 1 and condition 4 must be met at the same time, otherwise the operation will still be garbled. To ensure that it is not garbled code.

##Condition 1, Window | Preferences | Workspace | Text fileencoding | GBK encoding.
This defines the encoding of the entire work area.
This will determine the encoding format of the entire workspace, but if a certain project uses a different encoding format, it will be solved separately. As follows:


Condition 2, right-click on the project | Properties | Resource | Text fileencoding | UTF-8 encoding. Or a suitable encoding format. What is defined in this way is the encoding of the entire project.


#This will determine the encoding format of the entire project, but if a certain file uses a different encoding format, it will be solved separately. As follows:


Condition 3, right-click on a file | Properties | Resource | Text fileencoding | UTF-8 encoding.

or a suitable encoding format. What is defined in this way is the encoding of a single file.
What I want to say here is that the actual encoding format of the file should be used first: 3rd, then 2, and finally 1. Sometimes it's 123 and the conditions must be met. No matter how you try these encoding formats, you will know everything.


Condition 4, and the runtime encoding settings are as follows: Menu: Run Configuration | Console Encoding of Common tab on the right selects GBK encoding. This is used to control the console display. It must be GBK, so there will be no garbled characters. Although conditions 1, 2, and 3 are not GBK, as long as 4 is GBK. The console will not be garbled.
This ensures that the workspace and project code programming methods do not conflict with the encoding format of individual files in the project.
If there is no GBK option, it doesn’t matter. Just enter the three letters of GBK directly, Apply, and the GBK-encoded Chinese is no longer garbled.

One day, if we want to change the encoding format of other people's code, use the following methods: 1: Open it with Notepad, 2: Change the following encoding format such as UTF-8, 3: Save it as xxx.java

. In this way, the saved encoding format becomes the encoding format you want.

The above is the detailed content of Some explanations on the garbled code problem in eclipse. 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