Store mime_headers as BLOBs

Raw MIME messages may contain non-ASCII characters. Attempting to
store them as TEXT by using String::from_utf8_lossy results in
non-ASCII characters being replaced with Unicode U+FFFD "REPLACEMENT
CHARACTER" which is later incorrectly decoded when attempting to parse
`mime_headers` content into HTML.
This commit is contained in:
link2xt
2021-06-19 01:22:08 +03:00
parent c08df8d3da
commit a47c0486ae
6 changed files with 87 additions and 21 deletions

View File

@@ -72,6 +72,10 @@ CREATE TABLE msgs (
timestamp_sent INTEGER DEFAULT 0,
timestamp_rcvd INTEGER DEFAULT 0,
hidden INTEGER DEFAULT 0,
-- mime_headers column actually contains BLOBs, i.e. it may
-- contain non-UTF8 MIME messages. TEXT was a bad choice, but
-- thanks to SQLite 3 being dynamically typed, there is no need to
-- change column type.
mime_headers TEXT,
mime_in_reply_to TEXT,
mime_references TEXT,