Call the error handler for all codes >= 400, not just 404.
Encode the error response.  This means that if the caller has sent an
appropriate Accept-Encoding header then they will get the error response
encoded correctly.
Cope in the situations where a charset or encoding hasn't been chosen (or
doesn't match one of the available options) even though the resource
specifies some.  This happens in some cases when encoding the error
response.