简体   繁体   English

/usr/lib64/python3.4/http/client.py的编码问题

[英]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. 如果我运行:python3.4 ./bug.py“salé.txt”很好。

If I run : python3.4 ./bug.py "Capture d'écran du 2019-03-21 15-17-10.png" I got this error : 如果我运行:python3.4 ./bug.py“捕获了2019年3月21日的d'écran,我收到了这个错误:

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 卡里姆

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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