我现在终于遇到久违的乱码温问题了,有两种情况:
1、一种乱码是在myeclipse中编辑的时候,中文就显示乱码,但是,在tomcat部署运行的时候却正常显示。myeclipse编辑器中的显示:<FORM method="post" ACTION="save_info.jsp">
<font size="2"><br></font><table width="545" border="0" height="171">
<tbody><tr>
<td align="left"><font size="2">����</font></td>
<td><font size="2">&nbsp;<input type="text" name="sname"></font></td>
<td><font size="2">ƴ����д��</font></td>
<td><font size="2">&nbsp;<input type="text" name="name_CAPS"></font></td></tr>
<tr>
<td align="left"><font size="2">���֤�ţ�</font></td>
<td><font size="2">&nbsp;<input type="text" name="id"></font></td>
<td><font size="2">�������ڣ�</font></td>
<td><font size="2">&nbsp;<input type="text" name="birth"></font></td></tr>
<tr>
<td><font size="2">�Ա�</font></td>
<td><font size="2">&nbsp;<input type="text" name="ssex">&nbsp; <br></font></td>
<td><font size="2">���᣺</font></td>
<td><font size="2">&nbsp;<input type="text" name="address"></font></td></tr>
<tr>
<td><font size="2">��ѧ��ݣ�</font></td>
<td><font size="2">&nbsp;<input type="text" name="grade"></font></td>
<td><font size="2">�༶��&nbsp; <br></font></td>
<td><font size="2">&nbsp;<input type="text" name="classname"></font></td></tr>
<tr>
<td><font size="2">������ò��</font></td>
<td><font size="2">&nbsp;<input type="text" name="landscape"></font></td>
<td><font size="2">����ѧԺ��</font></td>
<td><font size="2">&nbsp;<input type="text" name="stepe"></font></td></tr>
<tr>
<td><font size="2">��ѧרҵ��</font></td>
<td><font size="2">&nbsp;<input type="text" name="professional"></font></td>
<td><font size="2">��ע��<br></font></td>
<td><font size="2">&nbsp;</font><font size="2"><input type="text" name="info"></font></td></tr>
</tbody></table><font size="2"><br></font><table width="545" border="0" height="112">
<tbody><tr><td valign="top"><font size="2">��Ƭ�� &nbsp; &nbsp; &nbsp; <br></font></td><td valign="top"><font size="2">  <input type="file" name="image"></font></td></tr><tr>
<td><font size="2">���У�<br></font></td>
<td><font size="2"><input type="text" name="middle" size="60" maxlength="500"></font></td></tr>
<tr>
<td><font size="2">���У�</font></td>
<td><font size="2"><input type="text" name="high" size="60" maxlength="500"></font></td></tr>
<tr>
<td><font size="2">��ѧ��</font></td>
<td><font size="2"><input type="text" name="college" size="60" maxlength="500"></font></td></tr>
</tbody></table><font size="2"><br></font><hr>
      <div align="left"><font size="2"><input type="submit" value="�ύ"></font></div></form>
浏览器中的显示:<FORM method="post" ACTION="save_info.jsp"><font size="2"><br></font><table width="545" border="0" height="171"><tbody><tr><td align="left"><font size="2">姓名:</font></td><td><font size="2">&nbsp;<input type="text" name="sname"></font></td><td><font size="2">拼音大写:</font></td><td><font size="2">&nbsp;<input type="text" name="name_CAPS"></font></td></tr><tr><td align="left"><font size="2">身份证号:</font></td><td><font size="2">&nbsp;<input type="text" name="id"></font></td><td><font size="2">出生日期:</font></td><td><font size="2">&nbsp;<input type="text" name="birth"></font></td></tr><tr><td><font size="2">性别:</font></td><td><font size="2">&nbsp;<input type="text" name="ssex">&nbsp; <br></font></td><td><font size="2">籍贯:</font></td><td><font size="2">&nbsp;<input type="text" name="address"></font></td></tr><tr><td><font size="2">入学年份:</font></td><td><font size="2">&nbsp;<input type="text" name="grade"></font></td><td><font size="2">班级:&nbsp; <br></font></td><td><font size="2">&nbsp;<input type="text" name="classname"></font></td></tr><tr><td><font size="2">政治面貌:</font></td><td><font size="2">&nbsp;<input type="text" name="landscape"></font></td><td><font size="2">所在学院:</font></td><td><font size="2">&nbsp;<input type="text" name="stepe"></font></td></tr><tr><td><font size="2">所学专业:</font></td><td><font size="2">&nbsp;<input type="text" name="professional"></font></td><td><font size="2">备注:<br></font></td><td><font size="2">&nbsp;</font><font size="2"><input type="text" name="info"></font></td></tr></tbody></table><font size="2"><br></font><table width="545" border="0" height="112"><tbody><tr><td valign="top"><font size="2">照片: &nbsp; &nbsp; &nbsp; <br></font></td><td valign="top"><font size="2">  <input type="file" name="image"></font></td></tr><tr><td><font size="2">初中:<br></font></td><td><font size="2"><input type="text" name="middle" size="60" maxlength="500"></font></td></tr><tr><td><font size="2">高中:</font></td><td><font size="2"><input type="text" name="high" size="60" maxlength="500"></font></td></tr><tr><td><font size="2">大学:</font></td><td><font size="2"><input type="text" name="college" size="60" maxlength="500"></font></td></tr></tbody></table><font size="2"><br></font><hr>      <div align="left"><font size="2"><input type="submit" value="提交"></font></div></form>2、在myeclipse中编辑的时候乱码,tomcat部署运行的时候还是乱码:  <font size="2">�1�71�1�77�1�71�1�77�1�71�1�77�1�71�1�77�1�71�1�77�1�71�1�77�1�70�1�74�1�71�1�77�1�71�1�70�1�70�1�75�1�70�1�76�1�71�1�77,<a href="show_info.jsp" title="�1�71�1�77�1�71�1�77�1�71�1�77�1�71�1�77�1�71�1�77�1�71�1�77�1�71�1�77�1�75�1�71�1�71�1�77�1�71�1�77�1�71�1�77�1�71�1�77�1�71�1�77�1�71�1�77�1�70�1�74">�1�71�1�77�1�75�1�71�1�71�1�77�1�71�1�77�1�71�1�77�1�71�1�77�1�71�1�77�1�71�1�77�1�70�1�74</a></font><br>
 
请问:怎么解决在myeclipse和部署运行都不乱吗?

解决方案 »

  1.   

    页面 设置 编码 方式啊  一般用 utf-8 ,再不行 你看看 这段代码 的编辑文本的 编码,尽量 用utf-8  ,最后 一个 办法,复制 到一个 编码方式 是  utf-8 的文本下 ,手动 重写 汉字,在 导入到 myeclipse 中,应该就没问题了
      

  2.   

    导入的时候出的错。  去Eclipse设置以下就好了。
       就是把默认文件的编码该成UTF-8
      

  3.   

    我觉得问题应该就在这里呃。请问一下具体的在哪里设置?我用的是myeclipse。
      

  4.   

    选中你的工程 右键 -》 properties -》resource 
    text file encoding 
    选 other 下拉框找到UTF-8
    不过你要保证你的JSP 也是UTF-8的
      

  5.   

    perference--》genaral--》content type找到Jsp,设置成UTF-8最好把所有的都设置成一样的编码
      

  6.   

    这个问题我以前也遇见过,有时候就是MyEclipse编辑器出现了问题:解决办法有两种:(1)如果是在你写代码的时候出现的乱码。试着把MyEclipse关掉再启动,或者查看MyEclipse编辑环境是否出现问题,因为不同 的工作区,工作区的环境设置会发生变化,那就看个人的设置情况了。(2)修改你页面的字符集为GBK。原因是可能你的页面的字符集是UTF-8或ISO-8859-1
      

  7.   

    我现在的页面使用的是GB18030。在resources里面没有找到这个编码。如何解决?
      

  8.   

    设置成这样看看  <%@ page contentType="text/html; charset=GBK"%>
      

  9.   

    MyEclipse 中文件属性,编码里边选选其他的,GBK,UTF-8 之类看看。