[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Sending attachments
From: |
Kenichi Handa |
Subject: |
Re: Sending attachments |
Date: |
Tue, 07 Jul 2009 09:59:56 +0900 |
In article <address@hidden>, Miles Bader <address@hidden> writes:
> Eli Zaretskii <address@hidden> writes:
>>> In the case non-ASCII character case mentioned above, he may not even
>>> _know_ that he needs to do anything or look at any documentation --
>>> he'll just send incorrect mail.
> >
> > Did you actually try that? Mail mode will not let you send such
> > messages, it will prompt for a proper encoding.
> You may be thinking of a different case.
> I did test sending a message with non-ASCII text in the header, which
> mail-mode sent incorrectly, without any prompting or warning (you can't
> just encode header text using the body's encoding, you need to use the
> special "?=" encoding stuff).
I've been believed that mail-mode (and the new rmail code)
supports non-ASCII Subject: correctly, but it was not. I've
just noticed that I'm using these setups in my .emacs. The
similar codes should be installed (of course, not as hooks).
(require 'rfc2047)
(defun rmail-decode-header ()
(save-excursion
(goto-char (point-min))
(search-forward "\n\n")
(if (re-search-backward "^subject:" nil t)
(let ((buffer-read-only nil)
(pos (match-end 0)))
(forward-line 1)
(while (looking-at "[ \t]")
(forward-line 1))
(rfc2047-decode-region pos (1- (point)))))))
(add-hook 'rmail-show-message-hook 'rmail-decode-header)
(require 'rmailsum)
(defun mail-decode-summary-line (line)
(rfc2047-decode-string line))
(setq rmail-summary-line-decoder 'mail-decode-summary-line)
(require 'sendmail)
(defun mail-encode-header ()
(save-excursion
(goto-char (point-min))
(search-forward mail-header-separator nil 'move)
(let ((case-fold-search t)
pos)
(when (re-search-backward "^subject:" nil t)
(setq pos (point))
(forward-line 1)
(while (looking-at "[ \t][^ \t\n]")
(forward-line 1))
(rfc2047-encode-region pos (1- (point)))))))
(add-hook 'mail-send-hook 'mail-encode-header)
(defun mail-decode-header ()
(save-excursion
(mail-position-on-field "Subject" t)
(if (not (bobp))
(let ((pos (point)))
(beginning-of-line)
(while (looking-at "[ \t]")
(forward-line -1))
(rfc2047-decode-region (point) pos)))))
(add-hook 'mail-setup-hook 'mail-decode-header)
---
Kenichi Handa
address@hidden
- Re: Sending attachments, (continued)
- Re: Sending attachments, Miles Bader, 2009/07/04
- Re: Sending attachments, Eli Zaretskii, 2009/07/04
- Re: Sending attachments, Miles Bader, 2009/07/04
- Re: Sending attachments, Eli Zaretskii, 2009/07/05
- Re: Sending attachments, Miles Bader, 2009/07/05
- Re: Sending attachments, Eli Zaretskii, 2009/07/05
- Re: Sending attachments, Miles Bader, 2009/07/05
- Re: Sending attachments, Miles Bader, 2009/07/06
- Re: Sending attachments, Eli Zaretskii, 2009/07/06
- Re: Sending attachments, Miles Bader, 2009/07/06
- Re: Sending attachments,
Kenichi Handa <=
- Re: Sending attachments, Alfred M. Szmidt, 2009/07/07
- Re: Sending attachments, Richard Stallman, 2009/07/07
- Re: Sending attachments, Stefan Monnier, 2009/07/11
- Re: Sending attachments, Alfred M. Szmidt, 2009/07/06
- Re: Sending attachments, Miles Bader, 2009/07/06
- Re: Sending attachments, Eli Zaretskii, 2009/07/06
- Re: Sending attachments, Chong Yidong, 2009/07/06
- Re: Sending attachments, Eli Zaretskii, 2009/07/06
- Re: Sending attachments, Giorgos Keramidas, 2009/07/07
- Re: Sending attachments, Richard Stallman, 2009/07/06