summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2004-05-13 22:50:12 (GMT)
committerBarry Warsaw <barry@python.org>2004-05-13 22:50:12 (GMT)
commit61e5616d746811a763633c6fc71c2f35ba601915 (patch)
treede5a25a2c57b58e51ac5265a2481886ef5d737f8 /Lib
parent4e59bc1e67e5459858d94b7e9fc41dfb0922ea62 (diff)
downloadcpython-61e5616d746811a763633c6fc71c2f35ba601915.zip
cpython-61e5616d746811a763633c6fc71c2f35ba601915.tar.gz
cpython-61e5616d746811a763633c6fc71c2f35ba601915.tar.bz2
encode_7or8bit(): Clearing out some old patches; iso-2202 is non-ASCII but
still 7-bit.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/email/Encoders.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/Lib/email/Encoders.py b/Lib/email/Encoders.py
index 5460fdb..6851094 100644
--- a/Lib/email/Encoders.py
+++ b/Lib/email/Encoders.py
@@ -1,8 +1,7 @@
-# Copyright (C) 2001,2002 Python Software Foundation
-# Author: barry@zope.com (Barry Warsaw)
+# Copyright (C) 2001-2004 Python Software Foundation
+# Author: barry@python.org (Barry Warsaw)
-"""Module containing encoding functions for Image.Image and Text.Text.
-"""
+"""Encodings and related functions."""
import base64
@@ -84,7 +83,13 @@ def encode_7or8bit(msg):
try:
orig.encode('ascii')
except UnicodeError:
- msg['Content-Transfer-Encoding'] = '8bit'
+ # iso-2022-* is non-ASCII but still 7-bit
+ charset = msg.get_charset()
+ output_cset = charset and charset.output_charset
+ if output_cset and output_cset.lower().startswith('iso-2202-'):
+ msg['Content-Transfer-Encoding'] = '7bit'
+ else:
+ msg['Content-Transfer-Encoding'] = '8bit'
else:
msg['Content-Transfer-Encoding'] = '7bit'