[Python-checkins] python/dist/src/Lib/email Message.py,1.27,1.28

bwarsaw@users.sourceforge.net bwarsaw@users.sourceforge.net
Thu, 10 Oct 2002 08:13:29 -0700


Update of /cvsroot/python/python/dist/src/Lib/email
In directory usw-pr-cvs1:/tmp/cvs-serv23530

Modified Files:
	Message.py 
Log Message:
get_content_charset(): RFC 2046 $4.1.2 says charsets are not case
sensitive.  Coerce the argument to lower case.


Index: Message.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/Message.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** Message.py	30 Sep 2002 18:17:35 -0000	1.27
--- Message.py	10 Oct 2002 15:13:26 -0000	1.28
***************
*** 761,766 ****
          """Return the charset parameter of the Content-Type header.
  
!         If there is no Content-Type header, or if that header has no charset
!         parameter, failobj is returned.
          """
          missing = []
--- 761,767 ----
          """Return the charset parameter of the Content-Type header.
  
!         The returned string is always coerced to lower case.  If there is no
!         Content-Type header, or if that header has no charset parameter,
!         failobj is returned.
          """
          missing = []
***************
*** 770,775 ****
          if isinstance(charset, TupleType):
              # RFC 2231 encoded, so decode it, and it better end up as ascii.
!             return unicode(charset[2], charset[0]).encode('us-ascii')
!         return charset
  
      def get_charsets(self, failobj=None):
--- 771,777 ----
          if isinstance(charset, TupleType):
              # RFC 2231 encoded, so decode it, and it better end up as ascii.
!             charset = unicode(charset[2], charset[0]).encode('us-ascii')
!         # RFC 2046, $4.1.2 says charsets are not case sensitive
!         return charset.lower()
  
      def get_charsets(self, failobj=None):