MyEclipse Chinese garbled poetry-level solutions. It can also be used for other encoding, myeclipse Epic
Recently, we found that all previously written projects are garbled. Only Chinese Characters in. java are garbled.
Because the later project changed the default encoding to the UTF-8, so it is messy.
The encoding of each encoding table is different. You cannot directly change an attribute to achieve this goal.
(Unless you call the environment for the first timeTo define the encoding format of the Project .)
String s = "China ";
Byte [] by = s. getBytes ("UTF-8 ");
For (byte B:)
{
System. out. println (B );
}
You can view the specific encoding.
In fact, myEclipse uses GBK encoding by default, which is the underlying layer of your system. You can verify the default encoding by changing the system language area. (Control Panel)
Obtain the system code:
System. out. println (System. getProperty ("file. encoding "));
System. out. println (Charset. defaultCharset ());
Changing the encoding of MyEclipse is nothing more than the following.
1. Right-click the project-Properties-Resoure-set the UTF-8 (for a project)
2. Windows-Preperties-General-Editors-Text Editors-Spelling (encoding)
3. Windows-Preperties-General-Workspace-UTF8 (global settings)
4. Windows-Preperties-General-Content Types-set each subitem to UTF-8 remember Update (global)
5. Windows-Preperties-MyEclipse-File and Editors-each subitem UTF-8 (default 2 properties for each type of File)
6. Add "-Dfile. encoding = UTF-8" to MyEclipse. ini.
It is nothing more than the above.
After a long call, I finally found the cause. It turns out that it is the GBK that is directly default when no environment is called before I write the project myself.
Now it will be garbled to turn into a UTF-8. GBK only supports Chinese characters. However, for project convenience, it is best to adjust the environment before project development to avoid garbled characters.
Garbled code is the most annoying aspect of Chinese programming. You know why !!!
Finally, I had.
Windows-Preperties-General-Content Types-JAVA Class File (*. java GBK-Update) can be properly displayed only when garbled code is called.
Export all.
Then one project with tools into a UTF-8 and then export in.
The tool is similar to Notepad ++ editplus for single file encoding conversion. Of course, this is only applicable to scenarios with few files.
In fact, it can also be opened in txt. Save as encoded by ANSI-> UTF-8
In fact, bulk files by GBK-> UTF-8 conversion tools also have.
Baidu GB2UTF8
Baidu Network Disk: http://pan.baidu.com/s/1qYrQUmC password: ybnl
You can put the project you want to convert in a single file. Add a directory.
During the upload directory, you will find the file extension (.doc). That is, it will scan the specified type of file.
*. Htm | *. html | *. vbs | *. js | *. asp | *. txt | *. java | *. xml | *. css | *. jsp uses | to differentiate file types. * Indicates all
MyEclipse can be further guided.
File-Import-General-Existing Projects into Workspace-Next-Browse (select the project folder ). Note: folder
Projects: Select All-Finish.
Normally, there is no problem. Haha
The first article is non-technical. Purely personal summary