From: Jae-hyeon Park <jhpark@kias.re.kr>
To: ding@gnus.org
Subject: iCalendar event without charset fails to display
Date: Sat, 29 Jan 2022 17:59:51 +0900 [thread overview]
Message-ID: <87fsp6hq7s.fsf@kias.re.kr> (raw)
[-- Attachment #1: Type: text/plain, Size: 3611 bytes --]
Hello,
Gnus that comes with GNU Emacs 27.2 fails to display an iCalendar event
if it sets no "charset" parameter. Strictly speaking, this does not
seem to be a Gnus' fault as section 3.1.4 of RFC5545 requires a
"charset" Content-Type parameter in MIME transports. On the other hand,
there may be a buggy application that generates iCalendar streams in a
non-UTF-8 charset or does not specify the "charset" parameter. The
attached patch would let Gnus tolerate these two types of bugs.
I hit the latter case where the "charset" property was missing, or more
precisely wrongly labelled "encoding":
======================================================================
Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil)
gnus-icalendar-event-from-handle((#<buffer *mm*-382724> ("text/calendar" (method . "REQUEST") (encoding . "utf-8") (filename . "event.ics")) nil nil nil nil nil nil) ("Jae-hyeon Park" "email@address\\.com"))
gnus-icalendar-mm-inline((#<buffer *mm*-382724> ("text/calendar" (method . "REQUEST") (encoding . "utf-8") (filename . "event.ics")) nil nil nil nil nil nil))
mm-display-inline((#<buffer *mm*-382724> ("text/calendar" (method . "REQUEST") (encoding . "utf-8") (filename . "event.ics")) nil nil nil nil nil nil))
mm-display-part((#<buffer *mm*-382724> ("text/calendar" (method . "REQUEST") (encoding . "utf-8") (filename . "event.ics")) nil nil nil nil nil nil) t)
gnus-mime-display-single((#<buffer *mm*-382724> ("text/calendar" (method . "REQUEST") (encoding . "utf-8") (filename . "event.ics")) nil nil nil nil nil nil))
gnus-mime-display-part((#<buffer *mm*-382724> ("text/calendar" (method . "REQUEST") (encoding . "utf-8") (filename . "event.ics")) nil nil nil nil nil nil))
mapcar(gnus-mime-display-part ((#<buffer *mm*-886772> ("text/plain" (charset . "utf-8")) 8bit (lambda nil (let ((inhibit-read-only t)) (delete-region #<marker (moves after insertion) at 7484 in *Article mail.list.physics.hep*> #<marker at 9377 in *Article mail.list.physics.hep*>))) ("inline") nil nil nil) (#<buffer *mm*-382724> ("text/calendar" (method . "REQUEST") (encoding . "utf-8") (filename . "event.ics")) nil nil nil nil nil nil)))
gnus-mime-display-mixed(((#<buffer *mm*-886772> ("text/plain" (charset . "utf-8")) 8bit (lambda nil (let ((inhibit-read-only t)) (delete-region #<marker (moves after insertion) at 7484 in *Article mail.list.physics.hep*> #<marker at 9377 in *Article mail.list.physics.hep*>))) ("inline") nil nil nil) (#<buffer *mm*-382724> ("text/calendar" (method . "REQUEST") (encoding . "utf-8") (filename . "event.ics")) nil nil nil nil nil nil)))
gnus-mime-display-part((#("multipart/mixed" 0 15 (start nil from "seminar@organizer.org" buffer #<buffer *mm*> boundary "===============5843370041342135681==")) (#<buffer *mm*-886772> ("text/plain" (charset . "utf-8")) 8bit (lambda nil (let ((inhibit-read-only t)) (delete-region #<marker (moves after insertion) at 7484 in *Article mail.list.physics.hep*> #<marker at 9377 in *Article mail.list.physics.hep*>))) ("inline") nil nil nil) (#<buffer *mm*-382724> ("text/calendar" (method . "REQUEST") (encoding . "utf-8") (filename . "event.ics")) nil nil nil nil nil nil)))
gnus-display-mime()
gnus-article-prepare-display()
gnus-article-prepare(1787 nil)
gnus-summary-display-article(1787)
gnus-summary-next-page(nil)
funcall-interactively(gnus-summary-next-page nil)
call-interactively(gnus-summary-next-page nil nil)
command-execute(gnus-summary-next-page)
======================================================================
Best regards,
Jae-hyeon
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gnus-icalendar-missing-charset.diff --]
[-- Type: text/x-diff, Size: 923 bytes --]
diff -ru emacs-27.2.orig/lisp/gnus/gnus-icalendar.el emacs-27.2/lisp/gnus/gnus-icalendar.el
--- emacs-27.2.orig/lisp/gnus/gnus-icalendar.el 2021-01-29 02:52:38.000000000 +0900
+++ emacs-27.2/lisp/gnus/gnus-icalendar.el 2022-01-29 16:37:17.738632355 +0900
@@ -753,11 +753,12 @@
(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 (string= (downcase ,charset) "utf-8")
- (decode-coding-region (point-min) (point-max) 'utf-8))
+ (decode-coding-region (point-min) (point-max) (intern ,charset))
,@body))))
next reply other threads:[~2022-01-29 9:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-29 8:59 Jae-hyeon Park [this message]
2022-01-29 14:44 ` Lars Ingebrigtsen
2022-02-16 5:09 ` Byung-Hee HWANG
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fsp6hq7s.fsf@kias.re.kr \
--to=jhpark@kias.re.kr \
--cc=ding@gnus.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).