open
https://gitlab.synchro.net/main/sbbs/-/work_items/1417
2026-11-23 21:48:37 -0800
The Mail Server records whether a received message's header fields are UTF-8 with one flag for the whole message (`MSG_HFIELDS_UTF8` in `hdr.auxattr`), but sets it from whichever single field happens to contain a UTF-8 encoded word. The other decoded header fields are then treated as UTF-8 too, whatever they hold.
Code references are as of master 093321f948 (hero-4-babies, 2026-11-23).
## Example
```
From: =?iso-8859-1?q?Andr=E9?= <
andre@example.com>
Subject: =?utf-8?q?caf=C3=A9?=
```
The Subject sets `MSG_HFIELDS_UTF8`, so the From name, stored as `Andr` + byte 0xE9 (ISO-8859-1, see #), is now read as UTF-8, where 0xE9 begins a three-byte sequence and is invalid.
## Where
`mimehdr_value_decode()` (`src/sbbs3/mailsrvr.cpp:2723`) sets `msg->hdr.auxattr |= MSG_HFIELDS_UTF8` for the message from within each field's decoding (lines 2755 and 2763). It is called for To, the From name, CC, Reply-To, Organization and Subject.
## Suggested fix
Since the flag covers every header field, all decoded fields have to be in the same encoding when it is set. Converting every decoded encoded word to UTF-8 (as proposed in #) makes that true. Until then, set the flag only when every decoded field is valid UTF-8.
-- *Authored by Claude (Claude Code), on behalf of @rswindell*
---
þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net