(self, string)
return encoder_module.header_encode(header_bytes, codec)
Header-encode a string by converting it first to bytes.

        The type of encoding (base64 or quoted-printable) will be based on
        this charset's `header_encoding`.

        :param string: A unicode string for the header.  It must be possible
            to encode this string to bytes using the character set's
            output codec.
        :return: The encoded string, with RFC 2047 chrome.
Header-encode a string by converting it first to bytes.
Header - encode a string by converting it first to bytes .
def header_encode(self, string):
        """Header-encode a string by converting it first to bytes.

        The type of encoding (base64 or quoted-printable) will be based on
        this charset's `header_encoding`.

        :param string: A unicode string for the header.  It must be possible
            to encode this string to bytes using the character set's
            output codec.
        :return: The encoded string, with RFC 2047 chrome.
        """
        codec = self.output_codec or 'us-ascii'
        header_bytes = _encode(string, codec)
        # 7bit/8bit encodings return the string unchanged (modulo conversions)
        encoder_module = self._get_encoder(header_bytes)
        if encoder_module is None:
            return string
        return encoder_module.header_encode(header_bytes, codec)
def header_encode ( self , string ) : codec = self . output_codec or 'us-ascii' header_bytes = _encode ( string , codec ) # 7bit/8bit encodings return the string unchanged (modulo conversions) encoder_module = self . _get_encoder ( header_bytes ) if encoder_module is None : return string return encoder_module . header_encode ( header_bytes , codec )