(self, failobj=None)
return charset.lower()
Return the charset parameter of the Content-Type header.

        The returned string is always coerced to lower case.  If there is no
        Content-Type header, or if that header has no charset parameter,
        failobj is returned.
Return the charset parameter of the Content-Type header.
Return the charset parameter of the Content - Type header .
def get_content_charset(self, failobj=None):
        """Return the charset parameter of the Content-Type header.

        The returned string is always coerced to lower case.  If there is no
        Content-Type header, or if that header has no charset parameter,
        failobj is returned.
        """
        missing = object()
        charset = self.get_param('charset', missing)
        if charset is missing:
            return failobj
        if isinstance(charset, tuple):
            # RFC 2231 encoded, so decode it, and it better end up as ascii.
            pcharset = charset[0] or 'us-ascii'
            try:
                # LookupError will be raised if the charset isn't known to
                # Python.  UnicodeError will be raised if the encoded text
                # contains a character not in the charset.
                as_bytes = charset[2].encode('raw-unicode-escape')
                charset = str(as_bytes, pcharset)
            except (LookupError, UnicodeError):
                charset = charset[2]
        # charset characters must be in us-ascii range
        try:
            charset.encode('us-ascii')
        except UnicodeError:
            return failobj
        # RFC 2046, $4.1.2 says charsets are not case sensitive
        return charset.lower()
def get_content_charset ( self , failobj = None ) : missing = object ( ) charset = self . get_param ( 'charset' , missing ) if charset is missing : return failobj if isinstance ( charset , tuple ) : # RFC 2231 encoded, so decode it, and it better end up as ascii. pcharset = charset [ 0 ] or 'us-ascii' try : # LookupError will be raised if the charset isn't known to # Python.  UnicodeError will be raised if the encoded text # contains a character not in the charset. as_bytes = charset [ 2 ] . encode ( 'raw-unicode-escape' ) charset = str ( as_bytes , pcharset ) except ( LookupError , UnicodeError ) : charset = charset [ 2 ] # charset characters must be in us-ascii range try : charset . encode ( 'us-ascii' ) except UnicodeError : return failobj # RFC 2046, $4.1.2 says charsets are not case sensitive return charset . lower ( )