title: HTTP reading and rewriting bytes
body: <p>I am getting a blob of binary data by executing a command-line program. This blob can be decoded by the same program.</p>
  
  <p>I would like to send this binary data in a HTTP response. For that I use the <code>"application/octet-stream"</code> mime-type (I also tried "text/plain"). But when the client gets the data on the other end, it is not readable anymore. The format has changed somehow.</p>
  
  <p>Here is my Scala code (but I think it is a generic question):</p>
  
  <pre><code>val command = s"samtools view -h $testbam $region"
  val res: String = command.!!    // Gets the stdout as string
  
  Result(
    header = ResponseHeader(200, Map.empty),
    body = HttpEntity.Strict(ByteString(res), Some("application/octet-stream"))
  )
  </code></pre>
  
  <p>The same command, run on the command-line, can be decoded properly. But the result of a "curl" here, although it does return a bunch of unreadable symbols, cannot be decoded.</p>
  
  <p>Sending the same data in its readable (uncompressed) form goes through properly without losing content or formatting.</p>
  
  <p>What kind of characters conversion am I missing ? Any encoding to specify ?</p>
  
  <p>Edit: Play 2.5.0</p>