(when (and (mm-handle-buffer handle)
(buffer-name (mm-handle-buffer handle)))
(with-temp-buffer
- (if (and (eq (mm-handle-encoding handle) '8bit)
- (with-current-buffer (mm-handle-buffer handle)
- enable-multibyte-characters))
- ;; Due to unfortunate historical reasons, we may have a
- ;; multibyte buffer here, but if it's using an 8bit
- ;; Content-Transfer-Encoding, then work around that by
- ;; just ignoring the situation.
- (insert-buffer-substring (mm-handle-buffer handle))
- ;; Do the decoding.
- (mm-disable-multibyte)
- (insert-buffer-substring (mm-handle-buffer handle))
- (mm-decode-content-transfer-encoding
- (mm-handle-encoding handle)
- (mm-handle-media-type handle)))
+ (mm-disable-multibyte)
+ (insert-buffer-substring (mm-handle-buffer handle))
+ (mm-decode-content-transfer-encoding
+ (mm-handle-encoding handle)
+ (mm-handle-media-type handle))
,@forms))))
(put 'mm-with-part 'lisp-indent-function 1)
(put 'mm-with-part 'edebug-form-spec '(body))
'charset)))
"ääää\n"))))))
-(ert-deftest test-mm-with-part-multibyte ()
- (with-temp-buffer
- (set-buffer-multibyte t)
- (nnheader-insert-file-contents (ert-resource-file "8bit-multipart.bin"))
- (while (search-forward "\r\n" nil t)
- (replace-match "\n"))
- (let ((handle (mm-dissect-buffer)))
- (pop handle)
- (let ((part (pop handle)))
- (should (equal (decode-coding-string
- (mm-with-part part
- (buffer-string))
- (intern (mail-content-type-get (mm-handle-type part)
- 'charset)))
- "ääää\n"))))))
-
(ert-deftest test-mm-dissect-buffer-win1252 ()
(with-temp-buffer
(set-buffer-multibyte nil)