Refactored code, made sure that response is always generated using its bodyEncoding, which is set by default to be defaultCharset from Server's configuration.