UnicodeEncodeError when sending e-mails with some iso-8859 characters (€ symbol)
@pengfeiye ci sta già lavorando.
Dal 15/1/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
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': 'some-test@address.com'}],
'cc': [],
'bcc': [],
'to': [{'name': '', 'email': 'some-address@example.com'}],
'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.
- Lingua principale
- Python
- Stelle
- 109
- Fork
- 85
- Merge medio
- 1g 21h
- PR unite (30g)
- 1
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di nylas/nylas-python
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 48/100
nylas/nylas-python#455 ·
-
nylas/nylas-python#454 · 3 commenti · 1 assegnatario ·
-
enhancement
nylas/nylas-python#412 · 1 commento · 5 reazioni · 1 assegnatario ·
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 38/100
nylas/nylas-python#402 · 1 reazione ·
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
nylas/nylas-python#401 ·
Tutte le issue di nylas/nylas-python
Issue simili
-
link-check link-check:sphinx-theme
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
OpenHands/extensions#626 · 1 commento ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
CSCfi/sd-search-api#39 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100