Strip the UTF8 BOM from a UTF encoded response

Some frameworks, such as .NET, often emit the UTF8 byte-order-mark in
the HTTP response.

This commit strips out the BOM when the encoding is set to 'utf8' and
improves compatibility with external services.

(This is a copy of a previous commit for issue #371, which no longer
cleanly applies and requires a refresh).