将撇号发送到Android不支持的API

时间:2019-01-23 09:59:11

标签: android

我已经开发了Android项目,因为我正在使用api使用api将图像和有关图像的注释发送到服务器。 我可以成功发送图片和便笺,但无法将撇号发送到api。我不知道为什么。我尝试了所有其他符号,例如+,-,。,[,]。等等。它在IOS项目中工作正常。我仅遇到Android Project的问题。

帮助我解决此问题。这是我的代码

            ArrayList<ImageNote> imageNoteArrayList = parkingLoad.imageNoteArrayList;
            File finalFile = new File(getExternalFilesDir(null).getAbsolutePath() + "/prjt_name/"+ 
      imageNoteArrayList.get(currentUploadingImageIndex).imageName);
            multipartEntity.addPart("userImage", new FileBody(finalFile));

            HttpClient client = new DefaultHttpClient();
            HttpPost httpPost = new HttpPost(params[0]);
            httpPost.setEntity(multipartEntity);
            HttpResponse response = client.execute(httpPost);
            int status = response.getStatusLine().getStatusCode();


            HttpEntity entity = response.getEntity();

            is = entity.getContent();

            BufferedInputStream in = new BufferedInputStream(is);

            BufferedReader reader = new BufferedReader(
                    new InputStreamReader(in), 8);

            StringBuilder sb = new StringBuilder();
            String line = null;
            while ((line = reader.readLine()) != null) {
                sb.append(line);
            }

            String json2 = sb.toString();

            if (json2 == null || json2.isEmpty()) {
                return null;
            } else {

                JSONObject resultObject = new JSONObject(json2);
                String resType = resultObject.getString("res_type");

                if (resType.equalsIgnoreCase("Error")) {

                    message = resultObject.getString("msg");
                    return false;
                } 
else {
                    message = resultObject.getString("msg");


                    return true;
                }
            }
        } 

0 个答案:

没有答案