title: Encoding HttpResponse UTF-8
body: <p>I get <code>HttpResponse</code> from url by method:</p>
  
  <pre><code>public void getResponse(String url) {
      String response;
      String str;
      BufferedReader bf;
      GZIPInputStream gzip;
      try {
          DefaultHttpClient httpClient = new DefaultHttpClient();
          HttpEntity httpEntity = null;
          HttpResponse httpResponse = null;
  
          HttpGet httpGet = new HttpGet(url);
  
          httpResponse = httpClient.execute(httpGet);
          httpEntity = httpResponse.getEntity();
          response = EntityUtils.toString(httpEntity, HTTP.UTF_8);
  
          System.out.println(response);
      } catch (UnsupportedEncodingException e) {
          e.printStackTrace();
      } catch (ClientProtocolException e) {
          e.printStackTrace();
      } catch (IOException e) {
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>but the response i got error like:</p>
  
  <pre><code>�P:�ˎ�#�I���!h����Ab���9�xQ�7۰=b��x&lt;M����n�
  </code></pre>
  
  <p>I checked the content encoding of 'HttpEntity' is 'gzip'.
  So, Is there any suggestion to encode response to utf8?</p>
  
  <p>Update: [SOLVED]
  I solved problem with method:</p>
  
  <pre><code>public void getResponse(String url) {
      String response;
      try {
          DefaultHttpClient httpClient = new DefaultHttpClient();
          HttpEntity httpEntity = null;
          HttpResponse httpResponse = null;
  
          HttpGet httpGet = new HttpGet(url);
  
          httpClient.addResponseInterceptor(new HttpResponseInterceptor() {
              @Override
              public void process(final HttpResponse response,
                 final HttpContext context) throws HttpException,
                 IOException {
                      HttpEntity entity = response.getEntity();
                      Header encheader = entity.getContentEncoding();
                      if (encheader != null) {
                          HeaderElement[] codecs = encheader.getElements();
                          for (int i = 0; i &lt; codecs.length; i++) {
                              if (codecs[i].getName().equalsIgnoreCase("gzip")) {
                                  response.setEntity(new GzipDecompressingEntity(entity));
                              return;
                              }
                          }
                      }
              }
          });
  
          httpResponse = httpClient.execute(httpGet);
          httpEntity = httpResponse.getEntity();
          response = EntityUtils.toString(httpEntity, HTTP.UTF_8);
  
          System.out.println(response);
      } catch (UnsupportedEncodingException e) {
          e.printStackTrace();
      } catch (ClientProtocolException e) {
          e.printStackTrace();
      } catch (IOException e) {
          e.printStackTrace();
      }
  }
  </code></pre>