From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 21168 invoked from network); 29 Jan 2022 09:00:14 -0000 Received: from mx1.math.uh.edu (129.7.128.32) by inbox.vuxu.org with ESMTPUTF8; 29 Jan 2022 09:00:14 -0000 Received: from lists1.math.uh.edu ([129.7.128.208]) by mx1.math.uh.edu with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nDjad-004fwm-JE for ml@inbox.vuxu.org; Sat, 29 Jan 2022 03:00:11 -0600 Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by lists1.math.uh.edu with smtp (Exim 4.94.2) (envelope-from ) id 1nDjad-003foR-55 for ml@inbox.vuxu.org; Sat, 29 Jan 2022 03:00:11 -0600 Received: from mx1.math.uh.edu ([129.7.128.32]) by lists1.math.uh.edu with esmtp (Exim 4.94.2) (envelope-from ) id 1nDjab-003foK-Kt for ding@lists.math.uh.edu; Sat, 29 Jan 2022 03:00:09 -0600 Received: from quimby.gnus.org ([95.216.78.240]) by mx1.math.uh.edu with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nDjaZ-004fwV-BH for ding@lists.math.uh.edu; Sat, 29 Jan 2022 03:00:09 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From: Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=W1lOxt1aIzIeGU1J2ajRCBnyqA7RoMieSFVe0UlX3LQ=; b=qGixtT5PnJ9te9xpr3e7MlNzlv gr0SLFv+uUA0oXzlM1zNRKMR4JPVXtet3B6L6N0kCjMsUHcrnkIArRpqXKpXWw0SMUMIBunpCj0E1 WVkmuJKhmt8Sz3/hJC7Y3VxgB4q5daL+OyB0eHwcUpXn9tXgYmmaIlTGyC3SMzeHQaQU=; Received: from mail.kias.re.kr ([210.98.29.13]) by quimby.gnus.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1nDjaQ-0000WS-Jb for ding@gnus.org; Sat, 29 Jan 2022 10:00:02 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; t=1643446798; s=s20201224; d=kias.re.kr; h=from:to:subject:date:message-id:mime-version:content-type; bh=kI8g3ze8IJRanFBe/Qu+/osQIOqswK2Co4NNZmK4NXE=; b=eNktZb3C2BuASBieBa4mirOTlnvHeCDS3wCg0Z6NRzP/xGAj6rGgpxyYf8CQrqPu S2orv1ua325VG7ztF0/fcQ7TeTaVjFYf1Mn4CsWf5TLrSML/JCwFw/90qb3cg+ZcAZy wYMrRFx+Ui7EfFuRkhkcVAIKEMIb1prkGbQbhR9A= Received: from kias.re.kr (116.127.156.116)(permitted) by kias.re.kr with ESMTP imoxion SensMail SmtpServer 10.0 id <49a0e44158414a13a056058409c86416> for from authenticated with (version=TLSv1.2 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384); Sat, 29 Jan 2022 17:59:52 +0900 Received: from jhpark by aida with local (Exim 4.94.2) (envelope-from ) id 1nDjaJ-0004TB-Rb for ding@gnus.org; Sat, 29 Jan 2022 17:59:51 +0900 From: Jae-hyeon Park To: ding@gnus.org Subject: iCalendar event without charset fails to display Date: Sat, 29 Jan 2022 17:59:51 +0900 Message-ID: <87fsp6hq7s.fsf@kias.re.kr> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" List-ID: Precedence: bulk --=-=-= Content-Type: text/plain 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((# ("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((# ("text/calendar" (method . "REQUEST") (encoding . "utf-8") (filename . "event.ics")) nil nil nil nil nil nil)) mm-display-inline((# ("text/calendar" (method . "REQUEST") (encoding . "utf-8") (filename . "event.ics")) nil nil nil nil nil nil)) mm-display-part((# ("text/calendar" (method . "REQUEST") (encoding . "utf-8") (filename . "event.ics")) nil nil nil nil nil nil) t) gnus-mime-display-single((# ("text/calendar" (method . "REQUEST") (encoding . "utf-8") (filename . "event.ics")) nil nil nil nil nil nil)) gnus-mime-display-part((# ("text/calendar" (method . "REQUEST") (encoding . "utf-8") (filename . "event.ics")) nil nil nil nil nil nil)) mapcar(gnus-mime-display-part ((# ("text/plain" (charset . "utf-8")) 8bit (lambda nil (let ((inhibit-read-only t)) (delete-region # #))) ("inline") nil nil nil) (# ("text/calendar" (method . "REQUEST") (encoding . "utf-8") (filename . "event.ics")) nil nil nil nil nil nil))) gnus-mime-display-mixed(((# ("text/plain" (charset . "utf-8")) 8bit (lambda nil (let ((inhibit-read-only t)) (delete-region # #))) ("inline") nil nil nil) (# ("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 # boundary "===============5843370041342135681==")) (# ("text/plain" (charset . "utf-8")) 8bit (lambda nil (let ((inhibit-read-only t)) (delete-region # #))) ("inline") nil nil nil) (# ("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 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=gnus-icalendar-missing-charset.diff 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)))) --=-=-=--