Subject: bug#56513: 28.1; Vcard in a mime part with a utf-8 charset is displayed incorrectly

From: Lars Ingebrigtsen <[email-masked]>
Date: Tue, 12 Jul 2022 15:02:00 +0200

Pascal Quesseveur <[email-masked]> writes:

>     (mm-insert-inline
>      handle
>      (concat "\n-- \n"
>              (if (and charset text)
>                  (mm-decode-string (string-make-unibyte text) charset)
>                text)))))
>
> When I use this function in mm-inline-media-tests display is OK.

Thanks.  I think it would be better to decode the data before handling
it to the vcard functions, so I've reworked the function that way
instead.

Can you check whether this fixes the problem, too?

diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el
index 57ce36a944..1bfef637bf 100644
--- a/lisp/gnus/mm-view.el
+++ b/lisp/gnus/mm-view.el
@@ -366,16 +366,15 @@ mm-inline-text-html
 	(apply (car func) handle (cdr func)))))))
 
 (defun mm-inline-text-vcard (handle)
-  (let ((inhibit-read-only t))
-    (mm-insert-inline
-     handle
-     (concat "\n-- \n"
-	     (ignore-errors
-	       (if (fboundp 'vcard-pretty-print)
-		   (vcard-pretty-print (mm-get-part handle))
-		 (vcard-format-string
-		  (vcard-parse-string (mm-get-part handle)
-				      'vcard-standard-filter))))))))
+  (let* ((inhibit-read-only t)
+         (charset (mail-content-type-get (mm-handle-type handle) 'charset))
+         (data (mm-decode-string (mm-get-part handle) charset))
+         (text (and data
+                    (if (fboundp 'vcard-pretty-print)
+                        (vcard-pretty-print data)
+                      (vcard-format-string
+                       (vcard-parse-string data 'vcard-standard-filter))))))
+    (mm-insert-inline handle (concat "\n-- \n" text))))
 
 (defun mm-inline-text (handle)
   (let ((b (point))

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no