title: CURL on Unix or Linux reports as binary file & shows control characters as opposed to what response header says and no issues on Windows
body: <p>When consuming JSON from an API into our NodeJS application using CURL on Linux slave (MacOS), we see binary file with control characters between every character although response header shows correct content-type (application/json; charset=utf-16)</p>
  
  <p>Attempting to remove control characters (json.parse) results in malformed JSON.</p>
  
  <p>Text editor on Windows (notepad, notepad++) don't show control characters as they convert the file encoding</p>
  
  <p>Using 'body-parser' also does not seem to work</p>
  
  <p>CURL command: </p>
  
  <pre><code>curl -D header.txt -o output.json -XGET "API call that returns JSON output" 
  </code></pre>
  
  <p>The below code replaces control characters only if requesting less product count from the API:</p>
  
  <pre><code>    if (_.isString(response)) {
            var responseString = response
            .replace(/[\u0000-\u001F]+/g, '');
  }
  </code></pre>
  
  <p>The API consumed by non unix/linux users are not having any issues. </p>
  
  <p>If the fix should be at the API level, please let us know what should be the fix?</p>
  
  <p>If the fix should be at the consuming end, please let us know what should be the fix?</p>