(self)
Yield a number of encodings that might work for this markup.
Yield a number of encodings that might work for this markup.
Yield a number of encodings that might work for this markup .
def encodings(self):
        """Yield a number of encodings that might work for this markup."""
        tried = set()
        for e in self.override_encodings:
            if self._usable(e, tried):
                yield e

        # Did the document originally start with a byte-order mark
        # that indicated its encoding?
        if self._usable(self.sniffed_encoding, tried):
            yield self.sniffed_encoding

        # Look within the document for an XML or HTML encoding
        # declaration.
        if self.declared_encoding is None:
            self.declared_encoding = self.find_declared_encoding(
                self.markup, self.is_html)
        if self._usable(self.declared_encoding, tried):
            yield self.declared_encoding

        # Use third-party character set detection to guess at the
        # encoding.
        if self.chardet_encoding is None:
            self.chardet_encoding = chardet_dammit(self.markup)
        if self._usable(self.chardet_encoding, tried):
            yield self.chardet_encoding

        # As a last-ditch effort, try utf-8 and windows-1252.
        for e in ('utf-8', 'windows-1252'):
            if self._usable(e, tried):
                yield e
def encodings ( self ) : tried = set ( ) for e in self . override_encodings : if self . _usable ( e , tried ) : yield e # Did the document originally start with a byte-order mark # that indicated its encoding? if self . _usable ( self . sniffed_encoding , tried ) : yield self . sniffed_encoding # Look within the document for an XML or HTML encoding # declaration. if self . declared_encoding is None : self . declared_encoding = self . find_declared_encoding ( self . markup , self . is_html ) if self . _usable ( self . declared_encoding , tried ) : yield self . declared_encoding # Use third-party character set detection to guess at the # encoding. if self . chardet_encoding is None : self . chardet_encoding = chardet_dammit ( self . markup ) if self . _usable ( self . chardet_encoding , tried ) : yield self . chardet_encoding # As a last-ditch effort, try utf-8 and windows-1252. for e in ( 'utf-8' , 'windows-1252' ) : if self . _usable ( e , tried ) : yield e