Lines Matching refs:encoded
1 """ Routines for manipulating RFC2047 encoded words.
24 # cte_decoded_string is the original binary that was encoded using the
33 # sequence as its argument and returns the length of the resulting encoded
38 # RFC 2047 "chrome" to the encoded string, and can optionally automatically
67 def decode_q(encoded):
68 encoded = encoded.replace(b'_', b' ')
69 return _q_byte_subber(encoded), []
72 # dict mapping bytes to their encoded form
100 def decode_b(encoded):
102 # This will succeed only if encoded includes no invalid characters.
103 pad_err = len(encoded) % 4
107 base64.b64decode(encoded + missing_padding, validate=True),
118 base64.b64decode(encoded, validate=False),
126 base64.b64decode(encoded + b'==', validate=False),
131 # This only happens when the encoded string's length is 1 more
134 # bpo-27397: Just return the encoded string since there's no
136 return encoded, [errors.InvalidBase64LengthDefect()]
153 """Decode encoded word and return (string, charset, lang, defects) tuple.
155 An RFC 2047/2243 encoded word has the form:
190 f"in encoded word; decoded as unknown bytes"))
207 Produces an RFC 2047/2243 encoded word of the form:
216 shortest encoded sequence is used, except that 'q' is preferred if it is up
218 RFC 2243 language string to specify in the encoded word.
230 encoded = _cte_encoders[encoding](bstring)
233 return "=?{}{}?{}?{}?=".format(charset, lang, encoding, encoded)