requeststring = "hidWxlx=spanCNLx" +
"&nMaxCount=100" +
"&nSetPageSize=10" +
"&txtLx=%" +
"&txtPY=HZ" +
"txtSearchType=1" +
//                              这是输入的地方 问题时输入字母可以 输入汉字或者是特殊字符就查不到我想要的结果
"&txtTm=" + new String(text.getString().getBytes("GBK"),"ISO-8859-1")+
"&txtWxlx=CN";
求问 该怎么解决 

解决方案 »

  1.   

    requeststring = "hidWxlx=spanCNLx" +
    "&nMaxCount=100" +
    "&nSetPageSize=10" +
    "&txtLx=%" +
    "&txtPY=HZ" +
    "txtSearchType=1" +
    // 这是输入的地方 问题时输入字母可以 输入汉字或者是特殊字符就查不到我想要的结果
    "&txtTm=" + URLEncoder.encode(text, "UTF-8")+
    "&txtWxlx=CN";获取值的时候 
    再URLDecoder.decode(text, "UTF-8");试试
      

  2.   

    我没java.net这个包 怎么办?
      

  3.   

    public void run(){
    String url =  "http://192.168.118.200/wxjs/tmjs.asp";
    String requeststring = null;
    try {
    requeststring = "hidWxlx=spanCNLx" +
    "&nMaxCount=100" +
    "&nSetPageSize=1" +
    "&txtLx=%" +
    "&txtPY=HZ" +
    "txtSearchType=1" +

    "&txtTm=" + text.getString().getBytes("gbk")+

    "&txtWxlx=CN";
    } catch (UnsupportedEncodingException e2) {
    e2.printStackTrace();
    }
    OutputStream osm = null;
    HttpConnection hc = null;
    System.out.println(requeststring);
    try{
    hc = (HttpConnection) Connector.open(url);
    hc.setRequestMethod(HttpConnection.POST); 
    }catch(IOException e1){ }
    try{
    hc.setRequestMethod(HttpConnection.POST); 
    hc.setRequestProperty("X-Online-Host","192.168.118.200");
    hc.setRequestProperty("User-Agent","Profile/MIDP-2.0 Configuration/CLDC-1.1");
    hc.setRequestProperty("Content-Language","en-US");
    hc.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
    hc.setRequestProperty("Accept","application/octet-stream");
    hc.setRequestProperty("Connection","Keep-Alive");
    hc.setRequestProperty("Content-Length",Integer.toString(requeststring != null?requeststring.length() : 0 ) );  
    osm = hc.openOutputStream();
    System.out.println("连接成功。。");
    DataOutputStream dos = new DataOutputStream(osm);
    System.out.println("发送请求中。。");
    byte[] b1 = requeststring.getBytes();
    for(int i=0;i<b1.length;i++){
    osm.write( b1[i]);
    }
    dos.close(); DataInputStream dis = hc.openDataInputStream();
    byte[] b2 = new byte[(int)hc.getLength()];
    dis.read(b2);
    String html = new String(b2,"gb2312");
    System.out.println(html);
    new toGetList(html);
    }catch(IOException e){
    e.printStackTrace();
    }
    }
    }这是我的这段代码 哪个地方不对给指点下 小弟 拜谢了
      

  4.   

    把拼接后的sql语句 在后台输出下 
    看看到底是什么样子的sql
      

  5.   

    还是中文乱码的问题。从客户端传入后台的应该是iso8859-1