emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 2c03bdc 2/2: Merge branch 'master' of git.sv.gnu.org:/srv/git/ema


From: Michael Albinus
Subject: master 2c03bdc 2/2: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Date: Sun, 10 Jan 2021 07:27:27 -0500 (EST)

branch: master
commit 2c03bdc887488537ef111cc44d5506eafc282ad5
Merge: aa6ee33 4ad8fc6
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
---
 .../gnus/mm-decode-resources/win1252-multipart.bin | 44 ++++++++++++++++++++++
 test/lisp/gnus/mm-decode-tests.el                  | 29 ++++++++++++++
 2 files changed, 73 insertions(+)

diff --git a/test/lisp/gnus/mm-decode-resources/win1252-multipart.bin 
b/test/lisp/gnus/mm-decode-resources/win1252-multipart.bin
new file mode 100644
index 0000000..d3c5026
--- /dev/null
+++ b/test/lisp/gnus/mm-decode-resources/win1252-multipart.bin
@@ -0,0 +1,44 @@
+To: example <example@example.org>
+From: example <example@example.org>
+Date: Tue, 5 Jan 2021 10:30:34 +0100
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="------------FB569A4368539497CC91D1DC"
+Content-Language: fr
+Subject: test
+
+--------------FB569A4368539497CC91D1DC
+Content-Type: multipart/alternative;
+ boundary="------------61C81A7DC7592E4C6F856A85"
+
+
+--------------61C81A7DC7592E4C6F856A85
+Content-Type: text/plain; charset=windows-1252; format=flowed
+Content-Transfer-Encoding: 8bit
+
+d�j� rat�
+
+--------------61C81A7DC7592E4C6F856A85
+Content-Type: text/html; charset=windows-1252
+Content-Transfer-Encoding: 8bit
+
+<html>
+  <head>
+    <meta http-equiv="content-type" content="text/html; charset=windows-1252">
+  </head>
+  <body>
+    d�j� rat�
+  </body>
+</html>
+
+--------------61C81A7DC7592E4C6F856A85--
+
+--------------FB569A4368539497CC91D1DC
+Content-Type: text/plain; charset="us-ascii"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Content-Disposition: inline
+
+mailing list signature
+
+--------------FB569A4368539497CC91D1DC--
+
diff --git a/test/lisp/gnus/mm-decode-tests.el 
b/test/lisp/gnus/mm-decode-tests.el
index 74591f9..6e8fae6 100644
--- a/test/lisp/gnus/mm-decode-tests.el
+++ b/test/lisp/gnus/mm-decode-tests.el
@@ -86,4 +86,33 @@
                                                        'charset)))
                        "ääää\n"))))))
 
+(ert-deftest test-mm-dissect-buffer-win1252 ()
+  (with-temp-buffer
+    (set-buffer-multibyte nil)
+    (insert-file-contents-literally (ert-resource-file 
"win1252-multipart.bin"))
+    (let ((handle (mm-dissect-buffer)))
+      (should (equal (mm-handle-media-type handle) "multipart/mixed"))
+      ;; Skip multipart type.
+      (pop handle)
+      (setq handle (car handle))
+      (pop handle)
+      (let ((part (pop handle)))
+        (should (equal (mm-handle-media-type part) "text/plain"))
+        (should (eq (mm-handle-encoding part) '8bit))
+        (with-current-buffer (mm-handle-buffer part)
+          (should (equal (decode-coding-string
+                          (buffer-string)
+                          (intern (mail-content-type-get (mm-handle-type part)
+                                                         'charset)))
+                         "déjà raté\n"))))
+      (let ((part (pop handle)))
+        (should (equal (mm-handle-media-type part) "text/html"))
+        (should (eq (mm-handle-encoding part) '8bit))
+        (with-current-buffer (mm-handle-buffer part)
+          (should (equal (decode-coding-string
+                          (buffer-string)
+                          (intern (mail-content-type-get (mm-handle-type part)
+                                                         'charset)))
+                         "<html>\n  <head>\n    <meta 
http-equiv=\"content-type\" content=\"text/html; charset=windows-1252\">\n  
</head>\n  <body>\n    déjà raté\n  </body>\n</html>\n")))))))
+
 ;;; mm-decode-tests.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]