title: How to set correct Content-Encoding
body: <p>I have some serious (or better say: <em>strange</em>) issues with the HTTP-header: Content-Encoding.</p>
  
  <p>I want to gzip my content before sending it to the clients browser. For this I am checking if the clients browser accepts gzip and if so I am using <code>ob_start("ob_gzhandler")</code> and setting the content-encoding: <code>$response-&gt;addHeader("Content-Encoding", "gzip");</code></p>
  
  <ul>
  <li><p>I think my problem is the manual setting of the Content-Encoding header. 
  If I use <code>$response-&gt;addHeader("Content-Encoding", "gzip");</code> the content is only shown in Opera.</p></li>
  <li><p>If I use <code>$response-&gt;addHeader("Content-Encoding", "'gzip'");</code> the content is shown correct in all browsers, but gzip compression checks say that it is not compressed and the W3C HTML Validation service cannot encode the page: </p></li>
  </ul>
  
  <blockquote>
    <p>The error was: Don't know how to decode Content-Encoding ''gzip''</p>
  </blockquote>
  
  <ul>
  <li>If I don't use the line and online use <code>ob_start("ob_gzhandler")</code> the page can only be shown in opera</li>
  </ul>
  
  <p>My complete lines of code, which does correct output in browser is following:</p>
  
  <pre><code>$accEncoding = $request-&gt;getHeader("http_accept_encoding");
  if($accEncoding !== NULL &amp;&amp; substr_count($accEncoding, 'gzip')) {
      ob_start("ob_gzhandler");
      $response-&gt;addHeader("Content-Encoding", "'gzip'");
      $response-&gt;addHeader("Vary", "Accept-Encoding");
  } else {
      ob_start();
  }
  </code></pre>
  
  <p>Am I using the ob_gzhandler wrong or am I doing any other mistake here? I am very confused about the correct handling of gzip output.</p>