简体   繁体   中英

Encoding problem with /usr/lib64/python3.4/http/client.py

I do not understand the error below. If I run : python3.4 ./bug.py "salé.txt" It is fine.

If I run : python3.4 ./bug.py "Capture d'écran du 2019-03-21 15-17-10.png" I got this error :

Traceback (most recent call last):
  File "./bug.py", line 45, in <module>
    status=testB_CreateSimpleDocumentWithFile(session)
  File "./bug.py", line 32, in testB_CreateSimpleDocumentWithFile
    status, result = session.create_document_with_properties(path,mydoc,simple_document,properties=props,files=kk)
  File "/home/karim/testatrium/nuxeolib/session.py", line 345, in create_document_with_properties
    _document_properties, _ = self.encode_properties(properties, files)
  File "/home/karim/testatrium/nuxeolib/session.py", line 251, in encode_properties
    _names, _sizes = self.upload_files(files, batch_id=_batch_id)
  File "/home/karim/testatrium/nuxeolib/session.py", line 136, in upload_files
    _status, _result = self.execute_api(param=_param, headers=_headers, file_name=_name)
  File "/home/karim/testatrium/nuxeolib/session.py", line 1325, in execute_api
    _connection.request(method, url, headers=h2, body=data)
  File "/usr/lib64/python3.4/http/client.py", line 1139, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib64/python3.4/http/client.py", line 1179, in _send_request
    self.putheader(hdr, value)
  File "/usr/lib64/python3.4/http/client.py", line 1110, in putheader
    values[i] = one_value.encode('latin-1') 
UnicodeEncodeError: 'latin-1' codec can't encode character '\u2019' in position 9: ordinal not in range(256)

The problem comes from the Right Single Quotation Mark. I do not manage to fix it. Thanks for any advice.

Karim

由于文件名不在您的控制范围内,因此我将对文件名进行清理。此问题中的任何方法都可以解决该问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM