basho/webmachine — pull request #173 by kellymclaughlin (2013-11-04 16:12:42+00:00)
Title: Encode the error response before sending it.

Pass the response from ErrorHandler:render_error through encode_body before
sending it. This means that if the client has sent an appropriate
Accept-Encoding or Accept-Charset header then they will get the error
response encoded correctly.

As part of this, we have to handle the situation where a charset or encoding
hasn't yet been chose (or doesn't match one of the available options) even
though the resource specifies some. This happens if the error response is
triggered before the encoding/charset header processing.