title: OKHTTP post special character encoding header
body: <p>When the piece of code below is run, no response is received from the server.  On  php side the following was header line was added. header("Content-Type: text/json; Charset=UTF-8");. Before post method ran successfully but now with this header content type no response from server is received. This line was added to the request           .addHeader("Content-Type","text/json; Charset=UTF-8")
  but still no result. Is the header assigned correctly ? and also can okhttp call accept special character. A help is most welcome.</p>
  
  <pre><code>RequestBody body = new FormEncodingBuilder()  
                      .add("visitor",MyApplication.pref.GetPreferences("acc_type").toLowerCase())
                      .add("id_customer",MyApplication.pref.GetPreferences("id_customer"))
                      .add("sector",sector)
                      .add("search_who_what",MyApplication.pref.GetPreferences("quiQuoi"))
                      .add("search_location",str_ou)
                      .add("agenda",MyApplication.pref.GetPreferences("agenda_envelop"))
                      .add("sort_by", "")
                      .add("advanced_agenda","")
                      .add("distance", "")
                      .build();
  
  
  public String post(String url, RequestBody body) {
  
  
  
          Request request = new Request.Builder()
          .url(url)
          .addHeader("Content-Type","text/json; Charset=UTF-8")
          .post(body)
          .build();
  
          String str_response="";
  
          Response response;
  
          try {
  
              response = client.newCall(request).execute();
  
              try {
  
                  str_response = response.body().string();
                  System.out.println("POST_BODY_RESPONSE: "+" url "+url+" strresp "+str_response);
  
              } catch (Exception ex){
  
                  Log.e("POST_BODY_RESPONSE: ",url+" resp "+str_response);
              }
  
          } catch (SocketTimeoutException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
              str_response = "";
  
          }catch (ConnectTimeoutException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
              str_response = "";
  
          } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
  
              str_response = "";
          }
  
          return str_response;
      }
  
  
  
  
  
  
  
  
  
  
  
  
  
  **Error Log:
  
  
  04-30 15:06:06.518: W/System.err(5295): java.lang.IllegalArgumentException: Multiple charsets: text/json; Charset=UTF-8;charset=utf-8
  04-30 15:06:06.518: W/System.err(5295):     at com.squareup.okhttp.MediaType.parse(MediaType.java:64)
  04-30 15:06:06.518: W/System.err(5295):     at com.squareup.okhttp.Call$RealResponseBody.contentType(Call.java:252)
  04-30 15:06:06.518: W/System.err(5295):     at com.squareup.okhttp.ResponseBody.charset(ResponseBody.java:86)
  04-30 15:06:06.518: W/System.err(5295):     at com.squareup.okhttp.ResponseBody.string(ResponseBody.java:82)
  04-30 15:06:06.528: W/System.err(5295):     at android.app.utils.OkHttp.post(OkHttp.java:78)
  04-30 15:06:06.528: W/System.err(5295):     at android.app.fragment.RechercheResult$2.run(RechercheResult.java:306)
  04-30 15:06:06.538: W/System.err(5295):     at java.lang.Thread.run(Thread.java:856)**
  </code></pre>