(rfc2231-decode-encoded-string): Don't decode things that are not 2-digit
authorKatsumi Yamaoka <yamaoka@jpl.org>
Fri, 30 May 2008 10:06:47 +0000 (10:06 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Fri, 30 May 2008 10:06:47 +0000 (10:06 +0000)
 hexadecimal characters that follow `%'s.

lisp/ChangeLog
lisp/rfc2231.el

index a7250a2..83be56e 100644 (file)
@@ -1,3 +1,8 @@
+2008-05-30  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * rfc2231.el (rfc2231-decode-encoded-string): Don't decode things that
+       are not 2-digit hexadecimal characters that follow `%'s.
+
 2008-05-29  Reiner Steib  <Reiner.Steib@gmx.de>
 
        * message.el (message-bogus-recipient-p): Fix type in doc string.
index 1dd2e43..523f664 100644 (file)
@@ -214,11 +214,11 @@ These look like:
     (mm-with-unibyte-buffer
       (insert value)
       (goto-char (point-min))
-      (while (search-forward "%" nil t)
+      (while (re-search-forward "%\\([0-9A-Fa-f][0-9A-Fa-f]\\)" nil t)
        (insert
         (prog1
-            (string-to-number (buffer-substring (point) (+ (point) 2)) 16)
-          (delete-region (1- (point)) (+ (point) 2)))))
+            (string-to-number (match-string 1) 16)
+          (delete-region (match-beginning 0) (match-end 0)))))
       ;; Decode using the charset, if any.
       (if (memq coding-system '(nil ascii))
          (buffer-string)