For silly enterprise-y reasons, some other software I use breaks if the encoding field is missing. This adds support on the Writer to include it in output.
Added bool field on the Writer
Added a set_write_encoding method on Writer
Broke the declaration writing out into a format_declaration method
Added code to write the encoding (currently guaranteed to be UTF-8)
Added tests
I called it write_encoding rather than just encoding to leave that name available for a future setting to actually choose the encoding itself, rather than just whether or not to write the encoding field.
For silly enterprise-y reasons, some other software I use breaks if the encoding field is missing. This adds support on the
Writer
to include it in output.Writer
set_write_encoding
method onWriter
format_declaration
methodI called it
write_encoding
rather than justencoding
to leave that name available for a future setting to actually choose the encoding itself, rather than just whether or not to write the encoding field.