]> git.eshelyaron.com Git - emacs.git/commitdiff
Make gnus-icalendar-with-decoded-handle more DWIM
authorJae-hyeon Park <jhpark@kias.re.kr>
Sat, 29 Jan 2022 14:44:44 +0000 (15:44 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Sat, 29 Jan 2022 14:44:44 +0000 (15:44 +0100)
* lisp/gnus/gnus-icalendar.el
(gnus-icalendar-with-decoded-handle): Assume that calendars with
no charset is utf-8.

Copyright-paperwork-exempt: yes

lisp/gnus/gnus-icalendar.el

index 754a1d91cb5da9834e7e3b0a4baaa2ac57b52d66..1bffdf3513a03d50ff3f801b0792ff252aab7c46 100644 (file)
@@ -830,11 +830,12 @@ These will be used to retrieve the RSVP information from ical events."
 (defmacro gnus-icalendar-with-decoded-handle (handle &rest body)
   "Execute BODY in buffer containing the decoded contents of HANDLE."
   (let ((charset (make-symbol "charset")))
-    `(let ((,charset (cdr (assoc 'charset (mm-handle-type ,handle)))))
+    `(let ((,charset (downcase
+                     (or (cdr (assoc 'charset (mm-handle-type ,handle)))
+                         "utf-8"))))
        (with-temp-buffer
          (mm-insert-part ,handle)
-         (when (and ,charset (string= (downcase ,charset) "utf-8"))
-           (decode-coding-region (point-min) (point-max) 'utf-8))
+         (decode-coding-region (point-min) (point-max) (intern ,charset))
          ,@body))))