title: What does `utf-8` charset change in a `multipart/form-data` HTTP request?
body: <p>In an attempt to upload a binary file to a web server, I observed that by setting the <code>Content-Type</code> header to a value with <code>charset="utf-8"</code> present, the POST request data integrity fails.</p>
  
  <p>Chrome seems to omit all <code>charset</code> attributes in both the header and the body while performing a file upload POST request all together.</p>
  
  <p>However, some web servers satisfy the request correctly if the <code>charset="utf-8"</code> attribute is included.</p>
  
  <p><strong>Working Example:</strong></p>
  
  <pre><code>POST /upload.php HTTP/1.1
  Content-Type: multipart/form-data; boundary=----FormBoundary
  
  ------FormBoundary
  Content-Disposition: form-data; name="fileupload"; filename="data.bin"
  Content-Type: application/octet-stream
  
  ------FormBoundary--
  
  HTTP/1.1 200 OK
  
  The file was received successfully.
  </code></pre>
  
  <p><strong>Failing Example:</strong></p>
  
  <pre><code>POST /upload.php HTTP/1.1
  Content-type: multipart/form-data; charset="utf-8"; boundary=----FormBoundary
  
  ------FormBoundary
  Content-Disposition: form-data; name="fileupload"; filename="data.bin"
  Content-Type: application/octet-stream
  
  ------FormBoundary--
  
  HTTP/1.1 200 OK
  
  The uploaded file seems to be broken.
  </code></pre>
  
  <p>The addition of the <code>charset="utf-8"</code> seems to make some web servers fail to decode uploaded data correctly, while it doesn't seem to affect the process in other web servers.</p>
  
  <p>Please note that in both cases, including the charset after the <code>application/octet-stream</code> type does not affect anything, I'm rather focusing on the addition after the <code>multipart/form-data</code> type.</p>
  
  <p>What happens in the server and/or the os when the unicode charset flag is present after the multipart type?</p>