Only encode when output stream is binary