diff options
| author | Lars Ingebrigtsen | 2017-01-27 13:53:47 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2017-01-27 13:54:50 +0100 |
| commit | 03c1080cd4c9b45fc9b7467e156085d4fce446a4 (patch) | |
| tree | 9ed61e17fb441ce89c98bfd77c7d3159215cfc2f | |
| parent | 90c76346740c097063b4a273ceb3af01327ff2a4 (diff) | |
| download | emacs-03c1080cd4c9b45fc9b7467e156085d4fce446a4.tar.gz emacs-03c1080cd4c9b45fc9b7467e156085d4fce446a4.zip | |
Fix charsets and encodings from non-file MIME parts
* lisp/gnus/mml.el (mml-generate-mime-1): Get the charsets and
encoding right for parts that do not originate from files.
| -rw-r--r-- | lisp/gnus/mml.el | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el index a0ca624909f..3a31349d378 100644 --- a/lisp/gnus/mml.el +++ b/lisp/gnus/mml.el | |||
| @@ -612,25 +612,32 @@ be \"related\" or \"alternate\"." | |||
| 612 | (with-temp-buffer | 612 | (with-temp-buffer |
| 613 | (set-buffer-multibyte nil) | 613 | (set-buffer-multibyte nil) |
| 614 | ;; First insert the data into the buffer. | 614 | ;; First insert the data into the buffer. |
| 615 | (cond | 615 | (if (and filename |
| 616 | ((cdr (assq 'buffer cont)) | 616 | (not (equal (cdr (assq 'nofile cont)) "yes"))) |
| 617 | (insert-buffer-substring (cdr (assq 'buffer cont)))) | 617 | (mm-insert-file-contents filename) |
| 618 | ((and filename | 618 | (insert |
| 619 | (not (equal (cdr (assq 'nofile cont)) "yes"))) | 619 | (with-temp-buffer |
| 620 | (mm-insert-file-contents filename)) | 620 | (cond |
| 621 | ((eq 'mml (car cont)) | 621 | ((cdr (assq 'buffer cont)) |
| 622 | (insert (cdr (assq 'contents cont)))) | 622 | (insert-buffer-substring (cdr (assq 'buffer cont)))) |
| 623 | (t | 623 | ((eq 'mml (car cont)) |
| 624 | (save-restriction | 624 | (insert (cdr (assq 'contents cont)))) |
| 625 | (narrow-to-region (point) (point)) | 625 | (t |
| 626 | (insert (cdr (assq 'contents cont))) | 626 | (insert (cdr (assq 'contents cont))) |
| 627 | ;; Remove quotes from quoted tags. | 627 | ;; Remove quotes from quoted tags. |
| 628 | (goto-char (point-min)) | 628 | (goto-char (point-min)) |
| 629 | (while (re-search-forward | 629 | (while (re-search-forward |
| 630 | "<#!+/?\\(part\\|multipart\\|external\\|mml\\|secure\\)" | 630 | "<#!+/?\\(part\\|multipart\\|external\\|mml\\|secure\\)" |
| 631 | nil t) | 631 | nil t) |
| 632 | (delete-region (+ (match-beginning 0) 2) | 632 | (delete-region (+ (match-beginning 0) 2) |
| 633 | (+ (match-beginning 0) 3)))))) | 633 | (+ (match-beginning 0) 3))))) |
| 634 | (setq charset | ||
| 635 | (mm-coding-system-to-mime-charset | ||
| 636 | (detect-coding-region | ||
| 637 | (point-min) (point-max) t))) | ||
| 638 | (encode-coding-region (point-min) (point-max) | ||
| 639 | charset) | ||
| 640 | (buffer-string)))) | ||
| 634 | (cond | 641 | (cond |
| 635 | ((eq (car cont) 'mml) | 642 | ((eq (car cont) 'mml) |
| 636 | (let ((mml-boundary (mml-compute-boundary cont)) | 643 | (let ((mml-boundary (mml-compute-boundary cont)) |