def start_meta(self, attrs):
httpEquiv = None<EOL>contentType = None<EOL>contentTypeIndex = None<EOL>tagNeedsEncodingSubstitution = False<EOL>for i in range(<NUM_LIT:0>, len(attrs)):<EOL><INDENT>key, value = attrs[i]<EOL>key = key.lower()<EOL>if key == '<STR_LIT>':<EOL><INDENT>httpEquiv = value<EOL><DEDENT>elif key == '<STR_LIT:content>':<EOL><INDENT>contentType = value<EOL>contentTypeIndex = i<EOL><DEDENT><DEDENT>if httpEquiv and contentType: <EOL><INDENT>match = self.CHARSET_RE.search(contentType)<EOL>if match:<EOL><INDENT>if (self.declaredHTMLEncoding is not None or<EOL>self.originalEncoding == self.fromEncoding):<EOL><INDENT>def rewrite(match):<EOL><INDENT>return match.group(<NUM_LIT:1>) + "<STR_LIT>"<EOL><DEDENT>newAttr = self.CHARSET_RE.sub(rewrite, contentType)<EOL>attrs[contentTypeIndex] = (attrs[contentTypeIndex][<NUM_LIT:0>],<EOL>newAttr)<EOL>tagNeedsEncodingSubstitution = True<EOL><DEDENT>else:<EOL><INDENT>newCharset = match.group(<NUM_LIT:3>)<EOL>if newCharset and newCharset != self.originalEncoding:<EOL><INDENT>self.declaredHTMLEncoding = newCharset<EOL>self._feed(self.declaredHTMLEncoding)<EOL>raise StopParsing<EOL><DEDENT>pass<EOL><DEDENT><DEDENT><DEDENT>tag = self.unknown_starttag("<STR_LIT>", attrs)<EOL>if tag and tagNeedsEncodingSubstitution:<EOL><INDENT>tag.containsSubstitutions = True<EOL><DEDENT>
Beautiful Soup can detect a charset included in a META tag,
        try to convert the document to that charset, and re-parse the
        document from the beginning.