Lines Matching refs:codec
98 # Map charsets to their Unicode codec strings.
130 Both input_charset and output_charset must have Unicode codec entries in
131 the module's charset-to-codec mapping; use add_codec(charset, codecname)
150 """Add a codec that map characters in the given charset to/from Unicode.
153 of a Python codec, as appropriate for the second argument to the unicode()
163 def _encode(string, codec):
164 if codec == UNKNOWN8BIT:
167 return string.encode(codec)
208 input_codec: The name of the Python codec used to convert the
209 input_charset to Unicode. If no conversion codec is
212 output_codec: The name of the Python codec used to convert Unicode
213 to the output_charset. If no conversion codec is necessary,
243 # guess and try a Unicode codec with the same name as input_codec.
292 output codec.
295 codec = self.output_codec or 'us-ascii'
296 header_bytes = _encode(string, codec)
301 return encoder_module.header_encode(header_bytes, codec)
311 output codec.
321 codec = self.output_codec or 'us-ascii'
322 header_bytes = _encode(string, codec)
324 encoder = partial(encoder_module.header_encode, charset=codec)
356 header_bytes = _encode(joined_line, codec)
361 header_bytes = _encode(joined_line, codec)
386 string using the ascii codec produces the correct string version