MBOX: Four Charsets and Both Transfer Encodings
One mailbox whose four messages each use a different charset and alternate between quoted-printable and base64, with RFC 2047 subjects to match. The file itself is LF-stored while the encoded payloads decode to CRLF text: the split every importer has to handle.
From ops@meridiansupply.example Wed Feb 18 08:00:00 2026
From: Meridian Ops <ops@meridiansupply.example>
To: Sam Rivera <sam@meridiansupply.example>
Subject: =?UTF-8?B?Q2FmZSDigJQgY3LDqG1lIGJyw7tsw6llIHRhc3Rpbmcg4piVIChTQU1QTEUp?=
Date: Wed, 18 Feb 2026 08:00:00 -0800
Message-ID: <p7-mbox-utf8@brightside.example>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Tasting confirmed: cr=C3=A8me br=C3=BBl=C3=A9e, caf=C3=A9 filtre.
Prix : 4,50 =E2=82=AC (SAMPLE).
From ops@meridiansupply.example Wed Feb 18 08:05:00 2026
From: Meridian Ops <ops@meridiansupply.example>
To: Sam Rivera <sam@meridiansupply.example>
Subject: =?ISO-8859-1?Q?R=FCckfrage_zur_Bestellung_Nr=2E_4711_=28Gr=F6=DFe=3A_gro=DF=29?=
Date: Wed, 18 Feb 2026 08:05:00 -0800
Message-ID: <p7-mbox-latin1@brightside.example>
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: base64
Uvxja2ZyYWdlIHp1ciBCZXN0ZWxsdW5nIE5yLiA0NzExLg0KRGllIEdy9t9lIGRlciBLYXJ0b25z
IGlzdCB6dSBncm/fLg0K
From ops@meridiansupply.example Wed Feb 18 08:10:00 2026
From: Meridian Ops <ops@meridiansupply.example>
To: Sam Rivera <sam@meridiansupply.example>
Subject: =?Shift_JIS?B?grKSjZW2gsyKbZRGIFNBTVBMRQ==?=
Date: Wed, 18 Feb 2026 08:10:00 -0800
Message-ID: <p7-mbox-sjis@brightside.example>
MIME-Version: 1.0
Content-Type: text/plain; charset="shift_jis"
Content-Transfer-Encoding: base64
grKSjZW2gsyKbZRGIFNBTVBMRQ0KlHqRl4LNi+CXapP6gsWCt4FCDQo=
From ops@meridiansupply.example Wed Feb 18 08:15:00 2026
From: Meridian Ops <ops@meridiansupply.example>
To: Sam Rivera <sam@meridiansupply.example>
Subject: =?KOI8-R?B?8M/E1NfF0tbExc7JxSDawcvB2sEgU0FNUExF?=
Date: Wed, 18 Feb 2026 08:15:00 -0800
Message-ID: <p7-mbox-koi8@brightside.example>
MIME-Version: 1.0
Content-Type: text/plain; charset="koi8-r"
Content-Transfer-Encoding: quoted-printable
=F0=CF=C4=D4=D7=C5=D2=D6=C4=C5=CE=C9=C5 =DA=C1=CB=C1=DA=C1 SAMPLE.
=E4=CF=D3=D4=C1=D7=CB=C1 =D7 =D0=D1=D4=CE=C9=C3=D5.Specifications
- Wave
- p7
- Seed
- 20260807
- Messages
- 4
- Charsets
- UTF-8, ISO-8859-1, Shift_JIS, KOI8-R
- Transfer Encodings
- quoted-printable + base64
- Escaping
- mboxrd
- Line Endings
- LF (Unix mailbox storage)
- Note
- base64 payloads decode to CRLF text even though the mailbox is LF-stored
Testing contract
Expected to pass- Scenario
- Split an LF-stored mailbox into four messages and decode each body with its own declared charset and transfer encoding.
- Expected result
- Four messages parse; each subject and body decodes to its declared charset, and decoded bodies carry CRLF breaks despite the mailbox being LF-terminated.
What is a .mbox file?
An MBOX file is a mailbox that stores many email messages concatenated into one plain-text file, each message preceded by a 'From ' separator line. It is the classic Unix mailbox format used by many mail clients for export and archival.
How to use this file
Use an example MBOX to test mailbox splitting, message boundary detection, thread reconstruction, and import into a mail client or parser.
How to use this file for testing
“MBOX: Four Charsets and Both Transfer Encodings” is a deterministic Testaroo fixture for Email parsing, Encoding detection, Internationalization. Standards-compliant RFC 822 messages (plain, multipart text+HTML, and with an attachment) plus an MBOX mailbox, for testing header parsing, MIME decoding, attachment extraction, and mailbox splitting.
Documented properties for this file: seed 20260807 · 4 messages · LF (Unix mailbox storage). Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.
Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such, expect parsers to fail loudly rather than silently accept them.
Email fixtures use fixed dates, message IDs, and MIME boundaries so runs are reproducible, and every address is fictional. Test header parsing, MIME decoding, attachment extraction, and EML/MBOX conversion against the documented structure.
Code examples
import mailbox
for msg in mailbox.mbox("p7-encodings.mbox"):
print(msg["subject"])Generated by generation/email_p7.py. Free for any use, no attribution required, license.
Related files
- emlEML, RFC 2047 Subject: ISO-8859-1 'B' EncodingThe ISO-8859-1 Subject again, base64-encoded instead of Q-encoded. Base64 hides the charset entirely, so this is the fixture that catches a decoder guessing the charset from the octets instead of reading the encoded-word's charset token.

- emlEML, RFC 2047 Subject: ISO-8859-1 'Q' EncodingA German Subject encoded as ISO-8859-1 'Q', the shape most legacy mail actually uses. Each umlaut is one =XX escape, so a decoder that assumes UTF-8 produces mojibake rather than a clean error.

- emlEML, RFC 2047 Subject: KOI8-R 'B' EncodingA Russian Subject as a KOI8-R base64 encoded-word. KOI8-R orders Cyrillic letters by Latin transliteration rather than alphabetically, so a decoder that substitutes any other Cyrillic codepage returns readable-looking but wrong text.

- emlEML, RFC 2047 Subject: Shift_JIS 'B' EncodingA Japanese Subject as a Shift_JIS base64 encoded-word. Shift_JIS second bytes overlap ASCII punctuation values, so a decoder that scans the decoded octets for delimiters before converting the charset splits the string in the wrong place.

- emlEML, RFC 2047 Subject: UTF-8 'B' EncodingA Subject header carrying accented Latin text and an emoji as a single UTF-8 base64 encoded-word. Its Q-encoded twin decodes to the identical string, so the two together isolate the encoding from the charset.

- emlEML, RFC 2047 Subject: UTF-8 'Q' EncodingThe same Subject as the UTF-8 'B' twin, written with 'Q' encoding instead: underscores stand for spaces and every non-token octet is an =XX escape. A decoder that forgets the underscore rule produces visibly different text from its twin.
