okhttp 2.7.* 修改格式编码

**

  • 还是直接贴代码比较好

**

         StringBuffer sb = new StringBuffer();
         if (params == null)
         {
             params = new Param[0]; 
         }

         for (Param param : params)
         {
             sb.append(param.key+"="+param.value+"&");
         }
         RequestBody body = RequestBody.create(MediaType.parse("application/x-www-form-urlencoded;charset=utf-8"),sb.toString());

         return new Request.Builder()
                 .url(url)
                 .post(body)
                 .build();

你可能感兴趣的:(Android,okhttp,修改编码)