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.
diff --git a/Lib/email/charset.py b/Lib/email/charset.py
index 8591527..24d5545 100644
--- a/Lib/email/charset.py
+++ b/Lib/email/charset.py
@@ -321,7 +321,7 @@
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()