This implements an old suggestion of Mark's to get wacky message-ids into the database directly without relying on underdefined behaviour of the gmime parser; the previous effort relied on gmime passing literally through message-ids not delimitted according RFC. Also compared to the previous version (id:"1326591624-15493-10-git-send-email-david@tethera.net"), this now uses valid UTF-8 text, rather than just ascii, although it is a bit biased towards ascii because most of the characters that cause problems are there. There is a fair amount of code here, but I hope the generation of random messages may be more useful in the future. The high level goal here is to (re)-introduce a hex-encoding based dump-restore that can pass this roundtrip test, and probably some batch tagging facility that shares code. If people don't mind things broken up into mini-series (without obvious gain in new features) like this, I'll probably post the hex-encoding infrastructure next.