Fix issue with UTF-8 BOM being written to the RFC3164 format and fix tests.