Fix header encoding of long headers when using euc-jp and shift_jis.

When a header was long enough to need to be split across lines, the
input charset name was used instead of the output charset name in
the encoded words.  This make a difference only for the two charsets
above.
This commit is contained in:
R David Murray 2011-03-14 21:13:03 -04:00
parent f2db4de4d8
commit 3a6152f3b3
2 changed files with 15 additions and 1 deletions

View file

@ -321,7 +321,7 @@ class Charset:
codec = self.output_codec or 'us-ascii'
header_bytes = _encode(string, codec)
encoder_module = self._get_encoder(header_bytes)
encoder = partial(encoder_module.header_encode, charset=str(self))
encoder = partial(encoder_module.header_encode, charset=codec)
# Calculate the number of characters that the RFC 2047 chrome will
# contribute to each line.
charset = self.get_output_charset()