android post方式提交中文数据到服务器乱码问题

Android端代码




                AsyncHttpClient client = new AsyncHttpClient();
                //URLEncoder.encode(category, "utf-8");  
                RequestParams params = new RequestParams();

                if(path1!=null){
                    file1=new File(path1);
                }
                if(path2!=null){
                    file2=new File(path2);
                }
                params.put("shopname", proname);
                params.put("description", description);
                params.put("price", proprice);
                params.put("userphone",usernum);
                params.put("category", category);


                client.post(url, params, new AsyncHttpResponseHandler(){
                    @Override
                    public void onSuccess(String content) {
                        // TODO Auto-generated method stub
                        super.onSuccess(content);
                        if(content.equals("发布成功")){
                            Toast.makeText(homepage.this, content, 0).show();
                            name.setText("");
                            price.setText("");
                            number.setText("");
                            intro.setText("");
                        }else{Toast.makeText(homepage.this, "发布失败", 0).show();}

                    }
                });

服务器端代码:




                if(ServletFileUpload.isMultipartContent(request)){
                try{
                    ServletFileUpload upload = new ServletFileUpload(
                            new DiskFileItemFactory());

                    List<FileItem> items = upload.parseRequest(request); // 解析请求

                    int size = items == null ? 0 : items.size();
                    for (int i = 0; i < size; i++) {
                        FileItem item = (FileItem) items.get(i); // 获取方法消息体中的每一段内容。
                        if (item.isFormField()) {// 如果是普通表单项目
                            if (item.getFieldName().equals("shopname")) {
                                shop.setShopname(new String(item.getString().getBytes("ISO8859-1"), "UTF-8"));
                            }  else if (item.getFieldName().equals("description")) {
                                shop.setDescription(new String(item.getString().getBytes("ISO8859-1"), "UTF-8"));
                            } else if (item.getFieldName().equals("price")) {
                                shop.setPrice((df.format(Double.valueOf(item.getString()))));
                            } else if (item.getFieldName().equals("userphone")) {
                                shop.setUserphone(item.getString());
                            } else if (item.getFieldName().equals("category")) {
                                shop.setCategory(new String(item.getString().getBytes("ISO8859-1"), "UTF-8"));
                                a=new String(item.getString().getBytes("ISO8859-1"), "UTF-8");
                            }/*else if (item.getFieldName().equals("picture")) {
                                shop.setPicture(new String(item.getString().getBytes("ISO8859-1"), "UTF-8"));
                            }else if(item.getFieldName().equals("picture1")){
                                shop.setPicture1(new String(item.getString().getBytes("ISO8859-1"), "UTF-8"));
                            }*/else if(item.getFieldName().equals("userid")){
                                shop.setUserid(Integer.parseInt(new String(item.getString().getBytes())));
                            }

为啥我用jsp提交中文不乱码,Android提交乱码呢,我用了android-async-http-1.4.4.jar包,post方式提交数据到服务器的,求解决,大神快来吧,我才接触Android,谢谢啦

双方统一编码合适就行了,比如utf8

params需要编成utf-8码

http://blog.csdn.net/u011596810/article/details/45793017
看看这个有没有帮助

客户端和服务器端发送和接受数据的编码格式要一致

编程是一种美德,是促使一个人不断向上发展的一种原动力。

客户端与服务端使用的编码不致吧;
服务端用的是Tomcat还是什么?

坚持打代码,是一种习惯。