'Sets a new string as response.  The value set must either by a
unicode or bytestring.  If a unicode string is set it\'s encoded
automatically to the charset of the response (utf-8 by default).
.. versionadded:: 0.9'

def set_data(self, value):

    if isinstance(value, text_type):
        value = value.encode(self.charset)
    else:
        value = bytes(value)
    self.response = [value]
    if self.automatically_set_content_length:
        self.headers['Content-Length'] = str(len(value))
