APPROVE COMMIT
NOTE: This patch has been committed.
Previous to this change, if your default buffer-file-coding-system was
UTF-8, your MIME content-transfer-encoding 8bit, and the mails you FCCed had
non-ASCII content, the act of FCCing would read in the buffer as binary and
write it out to the same file as UTF-8, changing every non-ASCII octet to
its UTF-8 equivalent. On every FCC to the folder. Which is not healthy for
your data.
Patch posted to xemacs-beta back in December, with message ID
16848.46742.104431.578670.dm0(a)vm.parhasard.net .
xemacs-packages/mail-lib/ChangeLog addition:
2005-04-02 Aidan Kehoe <kehoea(a)parhasard.net>
* sendmail.el (mail-do-fcc): Write the Unix mail file using the
binary coding system, as is appropriate for a file where non-ASCII
characters are encoded using separate MIME character sets for
every message, and thus no other single Mule coding system is
appropriate.
XEmacs Packages source patch:
Diff command: cvs -q diff -u
Files affected: xemacs-packages/mail-lib/sendmail.el
Index: xemacs-packages/mail-lib/sendmail.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/mail-lib/sendmail.el,v
retrieving revision 1.18
diff -u -u -r1.18 sendmail.el
--- xemacs-packages/mail-lib/sendmail.el 2004/11/08 02:50:32 1.18
+++ xemacs-packages/mail-lib/sendmail.el 2005/04/01 22:21:15
@@ -1225,8 +1225,16 @@
(insert "\n\C-_")
(write-region (point-min) (point-max) (car fcc-list) t)
(erase-buffer)))
- (write-region
- (1+ (point-min)) (point-max) (car fcc-list) t)))
+ ;; MIME processing should have eliminated any characters
+ ;; outside the range 0-255; if MIME processing hasn't been
+ ;; done, there's no reasonable expectation that the data will
+ ;; be preserved in a Unix mailbox, so we just write tildes for
+ ;; those chars. We set the coding system for write to 'binary
+ ;; to prevent any double-encoding that may occur if
+ ;; buffer-file-coding-system has been initialised to a
+ ;; non-binary-compatible coding system like, say, UTF-8.
+ (let ((coding-system-for-write 'binary))
+ (write-region (1+ (point-min)) (point-max) (car fcc-list) t))))
(and buffer (not dont-write-the-file)
(with-current-buffer buffer
(set-visited-file-modtime))))
--
“I, for instance, am gung-ho about open source because my family is being
held hostage in Rob Malda’s basement. But who fact-checks me, or Enderle,
when we say something in public? No-one!” -- Danny O’Brien
Show replies by date