(self, markup, user_specified_encoding=None,
                       document_declared_encoding=None)
:return: A 4-tuple (markup, original encoding, encoding
        declared within markup, whether any characters had to be
        replaced with REPLACEMENT CHARACTER).
:return: A 4-tuple (markup, original encoding, encoding
        declared within markup, whether any characters had to be
        replaced with REPLACEMENT CHARACTER).
: return : A 4 - tuple ( markup original encoding encoding declared within markup whether any characters had to be replaced with REPLACEMENT CHARACTER ) .
def prepare_markup(self, markup, user_specified_encoding=None,
                       document_declared_encoding=None):
        """
        :return: A 4-tuple (markup, original encoding, encoding
        declared within markup, whether any characters had to be
        replaced with REPLACEMENT CHARACTER).
        """
        if isinstance(markup, unicode):
            yield (markup, None, None, False)
            return

        try_encodings = [user_specified_encoding, document_declared_encoding]
        dammit = UnicodeDammit(markup, try_encodings, is_html=True)
        yield (dammit.markup, dammit.original_encoding,
               dammit.declared_html_encoding,
               dammit.contains_replacement_characters)
def prepare_markup ( self , markup , user_specified_encoding = None , document_declared_encoding = None ) : if isinstance ( markup , unicode ) : yield ( markup , None , None , False ) return try_encodings = [ user_specified_encoding , document_declared_encoding ] dammit = UnicodeDammit ( markup , try_encodings , is_html = True ) yield ( dammit . markup , dammit . original_encoding , dammit . declared_html_encoding , dammit . contains_replacement_characters )