title: Delphi: How to set TWebResponse to contain gzip and read it in Android App?
body: <p>I'm building a WebServer for Android App.(WebBroker->VC).</p>
  
  <p>How can I compress my response string to gzip, I tried this:</p>
  
  <pre><code> a:=[{.......}];//json data
   srcbuf := BytesOf(a.ToString);
   ZCompress(srcbuf, destbuf, zcDefault);
   Response.Content := '';
   Response.ContentStream := TMemoryStream.Create;
   Response.ContentEncoding := 'deflate';
   Response.ContentType := 'application/json';
   Response.ContentStream.Write(@(destbuf[0]),length(destbuf));
   Response.ContentLength := (length(destbuf));
  </code></pre>
  
  <p>In my android app I get error:</p>
  
  <p><strong>Uknown format (magic number...)</strong></p>
  
  <p>I also have server side written in PHP and android app works fine, I think that Delphi System.ZLib doesn't compress as gzip?</p>
  
  <p>Any idea how solve this?</p>