title: boto3 - 'utf-8' codec can't encode characters
body: <p>I am using boto3 to upload a file to S3:</p>
  <pre><code>s3client.upload_file(
       '/path/to/file',
       'destination-bucket',
       'destination-object-name')
  </code></pre>
  <p>which works when I run it under my local development environment (Ubuntu 18.04, python 3.8), however when deployed to dev server (using the same Docker container!) I get</p>
  <pre><code>ERROR - 'utf-8' codec can't encode characters in position 83-84: surrogates not allowed
  Traceback (most recent call last):
    File &quot;./myscript.py&quot;, line 1, in sync_with_s3
      s3client.upload_file(
    File &quot;/usr/local/lib/python3.8/site-packages/boto3/s3/inject.py&quot;, line 129, in upload_file
  </code></pre>
  <p>So I check which byte is at position 83-84 and find:</p>
  <pre><code>with open('/path/to/file', 'rb') as f:
       print(f.read()[83:84])
  # b'\x00'
  </code></pre>
  <p>When I look this byte up in UTF-8 table, I see that <code>b'\x00'</code> is the NULL character. I don't see why this would result in the error above.</p>
  <p>How can I proceed to debug this?</p>
  <p>Thanks a lot for the help</p>