(self, value)
Sets a new string as response.  The value set must be either 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
Sets a new string as response.  The value set must be either a
        unicode or bytestring.  If a unicode string is set it's encoded
        automatically to the charset of the response (utf-8 by default).
Sets a new string as response . The value set must be either a unicode or bytestring . If a unicode string is set it s encoded automatically to the charset of the response ( utf - 8 by default ) .
def set_data(self, value):
        """Sets a new string as response.  The value set must be either 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
        """
        # if an unicode string is set, it's encoded directly so that we
        # can set the content length
        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))
def set_data ( self , value ) : # if an unicode string is set, it's encoded directly so that we # can set the content length 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 ) )