From 64c7f7ffd5d9447cb0c2e7f259a8837b74a97bb8 Mon Sep 17 00:00:00 2001 From: shuhei Date: Wed, 11 Apr 2001 12:23:05 +0000 Subject: [PATCH] (mime-decode-parameter-value): Allow lowercase. (mime-decode-parameter-plist): Ditto. --- mime-parse.el | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/mime-parse.el b/mime-parse.el index 6715d24..727c0ac 100644 --- a/mime-parse.el +++ b/mime-parse.el @@ -150,7 +150,17 @@ be the result." (defun mime-decode-parameter-value (text charset language) (let ((start 0)) - (while (string-match "%[0-9A-F][0-9A-F]" text start) + ;; RFC 2231 is ambiguous about case-sensitivity. + ;; + ;; ext-octet := "%" 2(DIGIT / "A" / "B" / "C" / "D" / "E" / "F") + ;; + ;; If RFC 2234 is employed, this rule will match "%ab" as well as + ;; "%AB" because ABNF strings are case-insensitive. + ;; But it is not clear whether RFC 2231 employs RFC 2234 or not:-< + ;; + ;; Anyway, we choose to recognize lowercase letters here. + ;; (while (string-match "%[0-9A-F][0-9A-F]" text start) + (while (string-match "%[0-9A-Fa-f][0-9A-Fa-f]" text start) (setq text (replace-match (char-to-string (string-to-int (substring text @@ -225,7 +235,9 @@ property of the decoded-value." "\\)?'\\)" "\\(" mime-attribute-char-regexp - "\\|%[0-9A-F][0-9A-F]\\)+$")) + ;; allow lowercase letters. + ;; "\\|%[0-9A-F][0-9A-F]\\)+$" + "\\|%[0-9A-Fa-f][0-9A-Fa-f]\\)+$")) (car params)) (aset (cdr eparam) 0 ; section == 0. @@ -249,7 +261,9 @@ property of the decoded-value." (concat "^\\(" mime-attribute-char-regexp - "\\|%[0-9A-F][0-9A-F]\\)+$")) + ;; allow lowercase letters. + ;; "\\|%[0-9A-F][0-9A-F]\\)+$" + "\\|%[0-9A-Fa-f][0-9A-Fa-f]\\)+$")) (car params)) (aset (cdr eparam) section (list (car params) t)) -- 1.7.10.4