Add tests for encoding/bom handling (ref gh-2).