* rfc2047.el (rfc2047-parse-and-decode, rfc2047-decode): Use a
authorJesper Harder <harder@ifa.au.dk>
Mon, 12 Jan 2004 04:08:17 +0000 (04:08 +0000)
committerJesper Harder <harder@ifa.au.dk>
Mon, 12 Jan 2004 04:08:17 +0000 (04:08 +0000)
character for the encoding to avoid consing a string.

lisp/ChangeLog
lisp/rfc2047.el

index 99042af..64439d5 100644 (file)
@@ -1,5 +1,8 @@
 2004-01-12  Jesper Harder  <harder@ifa.au.dk>
 
+       * rfc2047.el (rfc2047-parse-and-decode, rfc2047-decode): Use a
+       character for the encoding to avoid consing a string.
+       
        * rfc2047.el (rfc2047-decode-string): Don't cons a string
        unnecessarily.
 
index 9d05c08..bac6129 100644 (file)
@@ -694,7 +694,7 @@ decodable."
      (condition-case nil
         (rfc2047-decode
          (match-string 1 word)
-         (upcase (match-string 2 word))
+         (string-to-char (match-string 2 word))
          (match-string 3 word))
        (error word))
      word)))                           ; un-decodable
@@ -712,7 +712,7 @@ decodable."
 
 (defun rfc2047-decode (charset encoding string)
   "Decode STRING from the given MIME CHARSET in the given ENCODING.
-Valid ENCODINGs are \"B\" and \"Q\".
+Valid ENCODINGs are the characters \"B\" and \"Q\".
 If your Emacs implementation can't decode CHARSET, return nil."
   (if (stringp charset)
       (setq charset (intern (downcase charset))))
@@ -732,13 +732,13 @@ If your Emacs implementation can't decode CHARSET, return nil."
        (setq cs mail-parse-charset))
       (mm-decode-coding-string
        (cond
-       ((equal "B" encoding)
+       ((char-equal ?B encoding)
         (base64-decode-string
          (rfc2047-pad-base64 string)))
-       ((equal "Q" encoding)
+       ((char-equal ?Q encoding)
         (quoted-printable-decode-string
          (mm-subst-char-in-string ?_ ? string t)))
-       (t (error "Invalid encoding: %s" encoding)))
+       (t (error "Invalid encoding: %c" encoding)))
        cs))))
 
 (provide 'rfc2047)