- (insert-buffer-substring pgg-output-buffer)
- (goto-char (point-min))
- (while (re-search-forward "\r+$" nil t)
- (replace-match "" t t))
- (quoted-printable-encode-region (point-min) (point-max))
- (goto-char (point-min))
- (if headers (insert headers))
- (insert "\n")
+ (mm-with-unibyte-current-buffer
+ (insert-buffer-substring pgg-output-buffer)
+ (goto-char (point-min))
+ (while (re-search-forward "\r+$" nil t)
+ (replace-match "" t t))
+ (mm-encode-content-transfer-encoding cte)
+ (goto-char (point-min))
+ (when headers
+ (insert headers))
+ (insert "\n"))