#11554: reactivate test_email_codecs, and make it pass.

The fix is to charset.py, which was not doing the encoding to the
correct output character set when doing a body_encode for either
the shift-jis or euc-jp charsets.  There's also a fix for handling
a bytes input in encoders.py.

Patch by Michael Henry, comment changes by me.
diff --git a/Lib/email/encoders.py b/Lib/email/encoders.py
index 0ea441d..c66f4cc 100644
--- a/Lib/email/encoders.py
+++ b/Lib/email/encoders.py
@@ -54,10 +54,13 @@
         # There's no payload.  For backwards compatibility we use 7bit
         msg['Content-Transfer-Encoding'] = '7bit'
         return
-    # We play a trick to make this go fast.  If encoding to ASCII succeeds, we
-    # know the data must be 7bit, otherwise treat it as 8bit.
+    # We play a trick to make this go fast.  If encoding/decode to ASCII
+    # succeeds, we know the data must be 7bit, otherwise treat it as 8bit.
     try:
-        orig.encode('ascii')
+        if isinstance(orig, str):
+            orig.encode('ascii')
+        else:
+            orig.decode('ascii')
     except UnicodeError:
         # iso-2022-* is non-ASCII but still 7-bit
         charset = msg.get_charset()