You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SSE drops UTF-8 characters split across transport chunks #62
On main at aa08a54 (Python 3.12), both iter_sse() and aiter_sse() corrupt UTF-8 when the HTTP stream splits a code point across chunks. ASCII streams look fine, but Chinese text, accented characters, or emoji can turn into U+FFFD. This is an SDK-side decoding issue; no server is needed.
Offline reproduction
fromioimportBytesIOfromhanzoaiimportiter_ssedata="data: 你好 é 🙂\n\n".encode()
print(next(iter_sse(BytesIO(data), chunk_size=1)).data)
Expected 你好 é 🙂; actual ������ �� ����.
Each chunk is decoded separately before buffering. A per-stream incremental UTF-8 decoder with the same replacement policy preserves split characters; flush it at EOF. Sync and async regression tests both failed on the original code and both passed after the change. A separate offline check split each sample at every byte boundary. AI-assisted; no live API was accessed.
Activity
linear commentedon Dec 5, 2026
HAI-567