jsp/servlet 乱码解决小方法

来源:互联网 发布:淘宝手机尺寸是多少608 编辑:程序博客网 时间:2024/06/10 06:17

import java.io.UnsupportedEncodingException;

        String s1 = (String)request.getParameter("txtcondition");

        try { 

            s1 = new String(s1.getBytes("ISO-8859-1"),"GB2312"); 
 
        } catch (UnsupportedEncodingException e1) {
            e1.printStackTrace();
        }