1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-13 09:32:47 +00:00

Make gnus-icalendar-with-decoded-handle more DWIM

* lisp/gnus/gnus-icalendar.el
(gnus-icalendar-with-decoded-handle): Assume that calendars with
no charset is utf-8.

Copyright-paperwork-exempt: yes
This commit is contained in:
Jae-hyeon Park 2022-01-29 15:44:44 +01:00 committed by Lars Ingebrigtsen
parent 4bac7d8c73
commit 852a5f24bb

View 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) (defmacro gnus-icalendar-with-decoded-handle (handle &rest body)
"Execute BODY in buffer containing the decoded contents of HANDLE." "Execute BODY in buffer containing the decoded contents of HANDLE."
(let ((charset (make-symbol "charset"))) (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 (with-temp-buffer
(mm-insert-part ,handle) (mm-insert-part ,handle)
(when (and ,charset (string= (downcase ,charset) "utf-8")) (decode-coding-region (point-min) (point-max) (intern ,charset))
(decode-coding-region (point-min) (point-max) 'utf-8))
,@body)))) ,@body))))