UnicodeEncodeError when sending e-mails with some iso-8859 characters (€ symbol)
@pengfeiye 已經在處理了。
開始於 2026年1月15日。
評估
這個 Issue 還沒有評估資料。
描述
Describe the bug
On last version (nylas==6.14.0), I'm getting an UnicodeEncodeError when sending an e-mail with a message body payload containing some special characters. The € currency symbol raise the error for example.
To Reproduce
With the following payload and Nylas client usage:
from nylas import Client
message = {
'subject': 'Test envoi avec accent',
'attachments': [],
'from': [{'name': 'Maxime L', 'email': '[email protected]'}],
'cc': [],
'bcc': [],
'to': [{'name': '', 'email': '[email protected]'}],
'reply_to': []
'body': '<p>À noter que lorem ipsum dolor sit...même éàçéàéà<br /><br />€€€€ ça c\'est de l\'euro</p>\r\n<br />---<br />Me',
}
client = Client("some-api-key", "some Nylas root URL")
client.messages.send(
"123456abcdef", # my grant is valid
request_body=message
)
The following exception is raised:
ERROR 'latin-1' codec can't encode characters in position 430-433: Body ('€€€€') is not valid Latin-1. Use body.encode('utf-8') if you want to send it encoded in UTF-8.
Traceback (most recent call last):
File "my_code.py", line 419, in send
client.messages.send(
File "~venv_packages/nylas/resources/messages.py", line 196, in send
json_response, headers = self._http_client._execute(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
[...]
File "/usr/local/lib/python3.12/http/client.py", line 1327, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/local/lib/python3.12/http/client.py", line 1372, in _send_request
body = _encode(body, 'body')
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/http/client.py", line 166, in _encode
raise UnicodeEncodeError(
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 430-433: Body ('€€€€') is not valid Latin-1. Use body.encode('utf-8') if you want to send it encoded in UTF-8.
(characters position slightly changed as I simplified my payload for anonymization)
Expected behavior
E-mail sent without errors, which is the behaviour on nylas 6.13.0 package and earlier.
SDK Version:
6.14.0.
- 主要語言
- Python
- 星號
- 109
- 分支
- 85
- 平均合併
- 8 小時 41 分鐘
- 30 天內合併 PR
- 3
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
nylas/nylas-python 的其他 Issue
-
Attachment downloads ignore request URL and header overrides可能已有人在做 @Kayvan-Zahiri 於 2 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 39/100
nylas/nylas-python#491 ·
-
bug
難度 2/5 1-3 小時 新手友好度 48/100
nylas/nylas-python#455 ·
-
Bug: drafts.create() fails with TypeError for multipart requests (attachments > 3MB)可能已有人在做 @benjaminwhtan 於 266 天前認領。 未關閉
nylas/nylas-python#454 · 3 則留言 · 已指派 1 人 ·
-
Create an async version of the client可能重新可做 @AaronDDM 於 495 天前認領,目前沒有進行中的 PR。 未關閉enhancement
nylas/nylas-python#412 · 1 則留言 · 5 個 reaction · 已指派 1 人 ·
-
bug
難度 3/5 1-2 天 新手友好度 38/100
nylas/nylas-python#402 · 1 個 reaction ·
查看 nylas/nylas-python 的全部 Issue
相似的 Issue
-
wr.dynamodb.read_items returns [{}] for a single partition value that does not exist可能已有人在做 @auraseb 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 84/100
aws/aws-sdk-pandas#3520 ·
維護者通常 2 天內回覆
-
requires triage typing
難度 2/5 1-3 小時 新手友好度 78/100
sqlalchemy/sqlalchemy#13704 ·
維護者通常 1 天內回覆
-
Edit tool converts CRLF files to LF可能已有人在做 @RaphaelFakhri 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 68/100
huggingface/tau#774 ·
維護者通常 1 天內回覆
-
show ignores the row limit when a column or table name contains "limit"可能已有人在做 @RaphaelFakhri 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 88/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 67/100
linebender/resvg#1179 · 1 則留言 ·
維護者通常 2 天內回覆