MyEclipse encoding settings, Chinese garbled solution, UTF-8,GBK

Source: Internet
Author: User


When we use MyEclipse or eclipse, we often encounter the problem of Chinese garbled, then we will be from the Eclipse software workspace, the code itself, the console and the server code settings for a brief introduction.


One, myeclipse work space coding.

    window-->preferences-->general-->workspace  Span style= "Color:rgb (51,51,51); font-family: ' Hiragino Sans GB W3 ', ' Hiragino Sans GB ', Arial, Helvetica, SimSun, u5b8bu4f 53;line-height:28px;background-color:rgb (255,255,255); " > on the right side of the Text file encoding->other    select UTF-8


Second, myeclipse edit file (jsp/html, etc.) the default encoding settings, that is, the format of the file save.

         when the myeclipse is not set, the default is to save the file encoding, generally with the Simplified Chinese operating system (such as Windows2000, windowsxp) is encoded in the same GBK.     
under the Simplified Chinese system, the ANSI encoding represents GBK encoding, and in the Japanese operating system, the ANSI encoding represents the JIS code.
    window-->preferences-->general-- Content Types
Expand each subkey in the right window, and then enter the encoding format, such as "UTF-8" and click "Update" to set it up.
For example: In the above settings, set the JSP default encoding format is "UTF-8", then the new JSP files are in "UTF-8" format saved. The
also sets the Java default encoding format to "UTF-8", then the new Java files are saved in "UTF-8" format. The
Set HTML default encoding format is "UTF-8", then the new HTML file is saved in "UTF-8" format.
  above set the file's save encoding format, the default mode of opening (decoding) will be the same as saving the encoding format.    


Iii. Coding settings for the project

On the projectRight-click-->properties-->resource on the right-hand text file encoding->other, you can make modifications.

Set to UTF-8


Four, the console encoding settings.

For the output to the console garbled, the above method will not be resolved. This garbled character belongs to the JVM (Java Virtual Machine) when running, the default output format of JVMs does not support Chinese cause. At this point, you must set the output format of the JVM. Here's how:


Select Run-and-run Config above the MyEclipse


Next, add "-dfile.encoding=utf-8" to the VM arguments

650) this.width=650; "border=" 0 "src=" http://img1.51cto.com/attachment/201109/191535324.jpg "width=" 650 "style=" Padding:0px;margin:0px;vertical-align:top;border:none; "/>

Choose Commo Here

650) this.width=650; "border=" 0 "src=" http://img1.51cto.com/attachment/201109/191535280.jpg " Width= "650" style= "padding:0px;margin:0px;vertical-align:top;border:none;"/>

After setting up, click Apply, then run, the console can output Chinese, not garbled (note: If you add " -dfile.encoding=gb2312" to the VM arguments, and the rear selection can be UTF-8, It can also be GBK support the Chinese format of the encoding set, UTF-8 is supported for all formats, so I use this. However, it is recommended that you set the encoding format and console to the same encoding format.


Five, the server's encoding settings

Here, for example, Tomcat enters Service.xml, and the other servers are entered into the configuration file.

<connector port= "protocol=" http/1.1 "connectiontimeout=" 20000 "uriencoding=" UTF-8 "Redi rectport= "8443"/>

Add this inside

Uriencoding= "UTF-8"

Can.

If none of this solves the problem.



This article is from the "12075002" blog, please be sure to keep this source http://12085002.blog.51cto.com/12075002/1864058

MyEclipse encoding settings, Chinese garbled solution, UTF-8,GBK

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.