1 Enter window->preferences
1.1 general->content types, you can set the default encoding value of Text to UTF-8 or empty.
encoding value to UTF-8 or empty, and then click update. Or you can click Text to enter the java source file properties, set the default
encoding to UTF-8 or null, then click update.
1.2 general->editors->text editors->selling. set the encoding property to UTF-8.
1.3 general->workspace. set the text file encoding to UTF-8.
1.4 myeclipse ->files and editors. Usually no changes are needed here, just leave it as default. The default encoding for ASP and
PHP and JSP encoding is ISO Latin-1, and the other properties encoding value is ISO 10646/Unicod(UTF-8).
2 Right-click on the properties of the project, select resource, and set the text file encoding value to UTF-8.
The above method can basically solve all the problems of garbled code, if not, you can select a java file, right-click properties properties, go to resource and select text
file
encoding is UTF-8. or put a single file into thetxt textIf you want to make sure that the code is not messed up, then copy it in. These two methods are only suitable for a small number of files garbled, not suitable for the whole project garbled.
-----------------------------------------------------------------------------
In the use of eclipse + MyEclipse development, many of the file encoding default is ISO-8859-1, does not support Chinese (such as commonly used JSP), so that we build each time the file have to manually change the code, in fact, we can set up the default file encoding, and then create the future will not have to modify the encoding each time, UTF-8
If you want to make plug-in development applications can have better internationalization support, to maximize support for Chinese output, it is best to make Java files using UTF-8 encoding. However, Eclipse workspace (workspace) the default character encoding isoperating systemDefault encoding, Simplified Chineseoperating system (Windows XP、Windows 2000The default code for (Simplified Chinese) isGB18030, the project code created in this workspace isGB18030The java files created in the project are alsoGB18030The following steps are needed to make the newly created project, java files directly UTF-8. If you want to make the newly created project, java file directly make UTF-8 you need to do the following:
1,windows->Preferences... Open the "Preferences" dialog box, the left side of the navigation tree, navigate to general->Workspace, the right side of the Text file encoding, select Other, change to UTF-8, and then the newly established project in the Properties dialog box in the Text file encoding is UTF-8.
2, windows->Preferences... Open the "Preferences" dialog box, the left navigation tree, navigate to general->Content Types, the right side of the Context Types tree, point to open the Text in each sub-item, and in the <Default encoding> enter "UTF-8", point update!
Other javaapplication developmentRelated files such as : properties, XML, etc. have been specified by default by Eclipse, respectively, ISO8859-1, UTF-8, such as the development of the need to change the encoding format can be specified here.
3, window - & gt; preference - & gt; MyEclipse - & gt; Files and Editors, will be each sub-item of the "Encoding" to "ISO 10645/Unicode (UTF-8)", point Apply!
4, after the above three steps, the new java file that is UTF-8 encoding, Eclipse compile, run, debugging are no problem, but do the RCP application Product output, or plug-in output, it is always wrong, either can not be compiled through (output to be recompile), or the output of the plug-in runtime Chinese display garbled. At this point you need to RCP applications, or plug-in Plugin project to add a line, javacDefaultEncoding... = UTF-8. = UTF-8, so that the output compiled to know the java source file when UTF-8 encoding. This setting needs to ensure that all java source files in UTF-8 encoding format, if not all, you can refer to the Eclipse help (Plug-in Development Environment Guide > Reference > Feature and Plug-in Build configuration), it is recommended that all java source files are UTF-8 encoded.
If plugin development, RCPapplication developmentThe original based on other encoding, such as GB18030, want to convert to UTF-8, then first, do the above work; and then by looking for encoding conversion tools, such as iconv-based batch conversion tool, the original encoding will be converted to UTF-8 encoding, pay attention to the conversion of only the java source file, the other types of files may have been a more appropriate encoding; will be the original project attributes in the Text file encoding in the properties of the original project can be changed from the original encoding to UTF-8.
--------------------------------------------------------------------
may be set before all formats are UTF-8, resulting in copying txt text into Myeclipse Chinese garbled phenomenon occurred(Since the .txt format in Myeclipse was previously set toUTF-8). Solution:
Import the TXT file again and it will display properly.
------------------------------------------------------------ Java source code appears garbled when importing project (need to change encoding, e.g. GBK):When importing a projectJavaThe source code is fine.,Red crosses in engineering packages are usually the result ofjarcontract (to or for)