Lines Matching refs:charset
40 from email.charset import Charset
67 # were invalid in the charset the source was supposed to be in. This
76 def formataddr(pair, charset='utf-8'):
84 The optional charset is the character set that is used to encode
96 if isinstance(charset, str):
97 charset = Charset(charset)
98 encoded_name = charset.header_encode(name)
242 def encode_rfc2231(s, charset=None, language=None):
245 If neither charset nor language is given, then s is returned as-is. If
246 charset is given but not language, the string is encoded using the empty
249 s = urllib.parse.quote(s, safe='', encoding=charset or 'ascii')
250 if charset is None and language is None:
254 return "%s'%s'%s" % (charset, language, s)
290 # decoding segments and concatenating, must have the charset and
302 charset, language, value = decode_rfc2231(value)
303 new_params.append((name, (charset, language, '"%s"' % value)))
315 charset, language, text = value
316 if charset is None:
317 # Issue 17369: if charset/lang is None, decode_rfc2231 couldn't parse
319 charset = fallback_charset
322 return str(rawbytes, charset, errors)
324 # charset is not a known codec.