UnicodeEncodeError when sending e-mails with some iso-8859 characters (€ symbol)
@pengfeiye arbeitet bereits daran.
Seit 15.1.2026.
Bewertung
Dieses Issue wurde noch nicht bewertet.
Beschreibung
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.
- Vorherrschende Sprache
- Python
- Sterne
- 109
- Forks
- 85
- Ø Merge
- 8 Std. 41 Min.
- Gemergte PRs (30 T.)
- 3
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus nylas/nylas-python
-
Attachment downloads ignore request URL and header overridesEvtl. vergeben @Kayvan-Zahiri hat das vor 2 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 39/100
nylas/nylas-python#491 ·
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 48/100
nylas/nylas-python#455 ·
-
Bug: drafts.create() fails with TypeError for multipart requests (attachments > 3MB)Evtl. vergeben @benjaminwhtan hat das vor 266 Tagen übernommen. Offen
nylas/nylas-python#454 · 3 Kommentare · 1 zugewiesene Person ·
-
Create an async version of the clientEvtl. wieder frei @AaronDDM hat das vor 495 Tagen übernommen, und es ist kein Pull Request offen. Offenenhancement
nylas/nylas-python#412 · 1 Kommentar · 5 Reaktionen · 1 zugewiesene Person ·
-
bug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 38/100
nylas/nylas-python#402 · 1 Reaktion ·
Alle Issues in nylas/nylas-python
Ähnliche Issues
-
good first issue tools
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
bug deferred domain:ci P1
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag
-
get_page_thumbnail modifies cached page images, affecting later thumbnails and picture exportsOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
docling-project/docling-mcp#147 ·
-
issue: A pipe model's Valves button ignores the Allow Chat Valves permissionEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offenbug confirmed issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
open-webui/open-webui#32771 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Scheduled Security Scan is failing on mainEvtl. vergeben @pkupt hat das heute übernommen. Offensecurity-scan-failure
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 74/100
semantica-agi/semantica#2045 ·
Maintainer antworten meist innerhalb von 2 Tagen