MyEclipse the Tomcat console print garbled solution

Source: Internet
Author: User


Issue background:

In the myeclipse development of the Tomcat version of the Web program, the program through the network request, from the remote server to obtain a string, displayed as garbled (including Chinese). The initial analysis is that because the character stream sent by the remote server is the UTF-8 encoding of the transmitted content, and the client obtains the character stream, it resolves to the string with the JVM's default encoding, which causes the garbled problem because of inconsistent server-client encoding.


Based on experience, we know:

Java Virtual machine string encoding by default following the operating system, the Chinese version of the Windows system is encoded as Gbk,linux system UTF8, if you need to manually set the encoding, you can add the following parameters when the JVM starts:

-dfile.encoding=utf-8


New problem: After adding the above parameters, the Java program output to standard output (that is, the common console), the log encoding will be UTF8, but myeclipse console, Windows cmd window, do not know that should be UTF8 encoding to parse the JVM output characters, So will come out garbled problem.


Final Solution:

In order for the JVM output encoding to be consistent with the console receiver, the console receive encoding needs to be set manually, as in MyEclipse:

1). Click Window-preferences-myeclipse-servers-tomcat-tomcat 7.x-launch, click the ' Create Launch Configuration ' button, Create a new debug Configuration .


650) this.width=650; "Src=" http://img.blog.csdn.net/20140226143549671?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvy29saw45mq==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/ Southeast "style=" Border:none;vertical-align:middle;margin:auto; "/>


2). In the Common tab, set encoding to Utf-8,

     arguments tab, add -dfile.encoding=utf-8 parameter is in the VM startup parameter. The following two figure:

650) this.width=650; "Src=" http://img.blog.csdn.net/20140226143950453?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvy29saw45mq==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/ Southeast "style=" Border:none;vertical-align:middle;margin:auto; "/>

650) this.width=650; "Src=" http://img.blog.csdn.net/20140226143938500?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvy29saw45mq==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/ Southeast "style=" Border:none;vertical-align:middle;margin:auto; "/>


3). After the above steps, MyEclipse a Tomcat 7.x [custom] to use this tomcat for future debug/deployment Projects.

650) this.width=650; "Src=" http://img.blog.csdn.net/20140226144140718?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvy29saw45mq==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/ Southeast "style=" Border:none;vertical-align:middle;margin:auto; "/>


In this way, MyEclipse, the Tomcat console is garbled and solved.



MyEclipse the Tomcat console print garbled solution

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.