Lines Matching refs:charset

18 from email import charset as _charset
43 three tuple (charset, language, value), it will be encoded according
45 be encoded according to RFC2231 rules, using the utf-8 charset and
50 # are (charset, language, value). charset is a string, not a Charset
297 payload = bpayload.decode(self.get_param('charset', 'ascii'), 'replace')
330 def set_payload(self, payload, charset=None):
333 Optional charset sets the message's default character set. See
337 if charset is None:
340 if not isinstance(charset, Charset):
341 charset = Charset(charset)
342 payload = payload.encode(charset.output_charset)
347 if charset is not None:
348 self.set_charset(charset)
350 def set_charset(self, charset):
351 """Set the charset of the payload to a given character set.
353 charset can be a Charset instance, a string naming a character set, or
355 If charset is None, the charset parameter will be removed from the
359 charset.input_charset. It will be converted to charset.output_charset
364 if charset is None:
365 self.del_param('charset')
368 if not isinstance(charset, Charset):
369 charset = Charset(charset)
370 self._charset = charset
375 charset=charset.get_output_charset())
377 self.set_param('charset', charset.get_output_charset())
378 if charset != charset.get_output_charset():
379 self._payload = charset.body_encode(self._payload)
381 cte = charset.get_body_encoding()
393 payload = payload.encode(charset.output_charset)
394 self._payload = charset.body_encode(payload)
550 three-tuple of (charset, language, value), in which case it will be
552 the utf-8 charset and a language of ''.
707 encoded in the us-ascii charset. You can usually ignore LANGUAGE.
729 charset=None, language='', replace=False):
742 If charset is specified, the parameter will be encoded according to RFC
744 to the empty string. Both charset and language should be strings.
746 if not isinstance(value, tuple) and charset:
747 value = (charset, language, value)
909 """Return the charset parameter of the Content-Type header.
912 Content-Type header, or if that header has no charset parameter,
916 charset = self.get_param('charset', missing)
917 if charset is missing:
919 if isinstance(charset, tuple):
921 pcharset = charset[0] or 'us-ascii'
923 # LookupError will be raised if the charset isn't known to
925 # contains a character not in the charset.
926 as_bytes = charset[2].encode('raw-unicode-escape')
927 charset = str(as_bytes, pcharset)
929 charset = charset[2]
930 # charset characters must be in us-ascii range
932 charset.encode('us-ascii')
936 return charset.lower()
939 """Return a list containing the charset(s) used in this message.
942 charset parameter for this message and all the subparts in its
945 Each item will either be a string (the value of the charset parameter
948 main MIME type of "text", or the charset is not defined.