Ext2.0 Form提交的中文乱码

阅读更多
我在写一个发送邮件程序,提交的中文怎么会是乱码呢?从服务器返回的中文都能正确显示:
public String testSendMail(){
		StringBuffer retJsonStr=new StringBuffer();
		
		if("".equals(mailTo)||mailTo==null){
			retJsonStr.append("{errors:[{id:'to', msg:'请输入收件人地址!'}]}");
			ByteArrayInputStream bais=new ByteArrayInputStream(retJsonStr.toString().getBytes());
			this.inputStream=bais;
			return SUCCESS;
		}
		if("".equals(mailSubject)||mailSubject==null){
			retJsonStr.append("{errors:[{id:'subject', msg:'请输入邮件主题!'}]}");
			ByteArrayInputStream bais=new ByteArrayInputStream(retJsonStr.toString().getBytes());
			this.inputStream=bais;
			return SUCCESS;
		}
		if("".equals(mailBody)||mailBody==null){
			retJsonStr.append("{errors:[{id:'body', msg:'请输入邮件内容!'}]}");
			ByteArrayInputStream bais=new ByteArrayInputStream(retJsonStr.toString().getBytes());
			this.inputStream=bais;
			return SUCCESS;
		}
		SendMail mailBean=new SendMail();
		
		mailBean.setMailFrom("[email protected]");
		mailBean.setMailTo(mailTo);
		mailBean.setMailSubject(mailSubject);
		mailBean.setMailBody(mailBody);
		mailBean.setMailHost("smtp.gmail.com");
		retJsonStr.append("{success:true, key:'success',msg:'"+mailBean.sendMail()+"', type:'type'}\n");

		ByteArrayInputStream bais=new ByteArrayInputStream(retJsonStr.toString().getBytes());
		this.inputStream=bais;
		return SUCCESS;

	}
  • 描述: 收到的邮件
  • 大小: 21.7 KB
  • Ext2.0 Form提交的中文乱码_第1张图片
  • 描述: 发送界面
  • 大小: 22.2 KB
  • 查看图片附件

你可能感兴趣的:(Ajax,Tomcat,EXT,json,Gmail)