From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/19101 Path: main.gmane.org!not-for-mail From: Shenghuo ZHU Newsgroups: gmane.emacs.gnus.general Subject: Re: MIME decoding broken on Win NT Date: 24 Nov 1998 03:50:36 -0500 Organization: Computer Dept of U Rochester Sender: owner-ding@hpc.uh.edu Message-ID: <2nu2zpxyn7.fsf@zsh.cs.rochester.edu> References: NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 X-Trace: main.gmane.org 1035157512 9843 80.91.224.250 (20 Oct 2002 23:45:12 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 20 Oct 2002 23:45:12 +0000 (UTC) Return-Path: Original-Received: from karazm.math.uh.edu (karazm.math.uh.edu [129.7.128.1]) by sclp3.sclp.com (8.8.5/8.8.5) with ESMTP id DAA23942 for ; Tue, 24 Nov 1998 03:54:50 -0500 (EST) Original-Received: from sina.hpc.uh.edu (lists@Sina.HPC.UH.EDU [129.7.3.5]) by karazm.math.uh.edu (8.9.1/8.9.1) with ESMTP id CAB01729; Tue, 24 Nov 1998 02:52:02 -0600 (CST) Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Tue, 24 Nov 1998 02:51:59 -0600 (CST) Original-Received: from sclp3.sclp.com (root@sclp3.sclp.com [204.252.123.139]) by sina.hpc.uh.edu (8.7.3/8.7.3) with ESMTP id CAA27441 for ; Tue, 24 Nov 1998 02:51:49 -0600 (CST) Original-Received: from cayuga.cs.rochester.edu (cayuga.cs.rochester.edu [192.5.53.209]) by sclp3.sclp.com (8.8.5/8.8.5) with SMTP id DAA23909 for ; Tue, 24 Nov 1998 03:51:41 -0500 (EST) Original-Received: from slate.cs.rochester.edu (slate.cs.rochester.edu [192.5.53.101]) by cayuga.cs.rochester.edu (8.6.9/O) with ESMTP id DAA07933 for ; Tue, 24 Nov 1998 03:51:39 -0500 Original-Received: from brain.cs.rochester.edu (heart.cs.rochester.edu [192.5.53.109]) by slate.cs.rochester.edu (8.6.9/O) with ESMTP id DAA14775 for ; Tue, 24 Nov 1998 03:51:35 -0500 Original-Received: (from zsh@localhost) by brain.cs.rochester.edu (8.9.0/8.8.5) id DAA01765; Tue, 24 Nov 1998 03:50:38 -0500 Original-To: ding@gnus.org X-Attribution: ZSH X-Face: 'IF:e51ib'Qbl^(}l^&4-J`'P!@[4~O|&k#:@Gld#b/]oMq&`&FVY._3+b`mzp~Jeve~/#/ ERD!OTe<86UhyN=l`mrPY)M7_}`Ktt\K+58Z!hu7>qU,i.N7TotU[FYE(f1;}`g2xj!u*l`^&=Q!g{ *q|ddto|nkt"$r,K$[)"|6,elPH= GJ6Q In-Reply-To: Matt Armstrong's message of "23 Nov 1998 12:51:36 -0800" Original-Lines: 125 User-Agent: Gnus/5.070053 (Pterodactyl Gnus v0.53) XEmacs/20.4 (Emerald) Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:19101 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:19101 >>>>> "Matt" == Matt Armstrong writes: Matt> MIME decoding is broken again under Win NT (it got fixed somewhere Matt> around 0.35, but broken somewhere since then). Under Win NT, Matt> default-buffer-file-coding-system is undecided-dos, not Matt> undecided-unix. There are places in the MIME handling within pgnus Matt> where the default buffer-file-coding-system is used, so cr/lf Matt> translation happens on binary stuff. Matt> I sent myself a binary attachment consisting of two bytes: "\r\n". Matt> Getting that to decode correctly (with the standard "1 b" key Matt> sequence) involved this patch: Matt> *** mm-decode.el.orig Mon Nov 23 11:52:04 1998 Matt> --- mm-decode.el Mon Nov 23 12:22:18 1998 Matt> *************** Matt> *** 447,453 **** Matt> (when (or (not (file-exists-p file)) Matt> (yes-or-no-p (format "File %s already exists; overwrite? " Matt> file))) Matt> ! (write-region (point-min) (point-max) file))))) Matt> (defun mm-pipe-part (handle) Matt> "Pipe HANDLE to a process." Matt> --- 447,458 ---- Matt> (when (or (not (file-exists-p file)) Matt> (yes-or-no-p (format "File %s already exists; overwrite? " Matt> file))) Matt> ! (let ((coding-system-for-write Matt> ! (if (equal "text" (car (split-string Matt> ! (car (mm-handle-type handle)) "/"))) Matt> ! 'buffer-file-coding-system Matt> ! 'binary))) Matt> ! (write-region (point-min) (point-max) file)))))) Matt> (defun mm-pipe-part (handle) These codes are in (mm-with-unibyte-buffer ...), in which buffer-file-coding-system is supposed to be binary. But in mm-with-unibyte-buffer, buffer-file-coding-system is set to nil, which is not equivalent to binary, though it works good in Unix. mm-with-binary-buffer seems to be a better name than mm-with-unibyte-buffer. Other modifications are replacing no-conversion with binary, since `no-conversion' is defined differently in GNU Emacs and XEmacs. NT Emacs user, please test the patch to save and view images. -- Shenghuo :- cut --------------------------------------------------------- --- ChangeLog 1998/11/24 07:57:08 1.3 +++ ChangeLog 1998/11/24 08:25:07 @@ -1,3 +1,11 @@ +Tue Nov 24 03:01:48 1998 Shenghuo ZHU + + * mm-decode.el (mm-display-external): Use binary instead of + no-conversion. + * gnus-agent.el (gnus-agent-file-coding-system): Ditto. + * nnheader.el (nnheader-file-coding-system): Ditto. + * mm-util.el (mm-with-unibyte-buffer): Use binary instead of nil. + Mon Nov 23 01:51:57 1998 Shenghuo ZHU * gnus-sum.el (gnus-newsgroup-setup-default-charset): Use group --- mm-util.el 1998/11/23 05:51:21 1.1 +++ mm-util.el 1998/11/24 07:58:43 @@ -220,7 +220,7 @@ (get-buffer-create (generate-new-buffer-name " *temp*"))) (unwind-protect (with-current-buffer ,temp-buffer - (let (buffer-file-coding-system) + (let ((buffer-file-coding-system 'binary)) ,@forms)) (and (buffer-name ,temp-buffer) (kill-buffer ,temp-buffer)))) --- nnheader.el 1998/11/23 05:51:23 1.1 +++ nnheader.el 1998/11/24 08:24:35 @@ -754,7 +754,7 @@ (when (string-match (car ange-ftp-path-format) path) (ange-ftp-re-read-dir path))))) -(defvar nnheader-file-coding-system 'no-conversion +(defvar nnheader-file-coding-system 'binary "Coding system used in file backends of Gnus.") (defun nnheader-insert-file-contents (filename &optional visit beg end replace) --- mm-decode.el 1998/11/23 05:51:21 1.1 +++ mm-decode.el 1998/11/24 08:07:30 @@ -237,7 +237,7 @@ (select-window win))) (switch-to-buffer (generate-new-buffer "*mm*"))) (buffer-disable-undo) - (mm-set-buffer-file-coding-system 'no-conversion) + (mm-set-buffer-file-coding-system 'binary) (insert-buffer-substring cur) (message "Viewing with %s" method) (let ((mm (current-buffer))) @@ -261,7 +261,7 @@ dir)) (setq file (make-temp-name (expand-file-name "mm." dir)))) (write-region (point-min) (point-max) - file nil 'nomesg nil 'no-conversion) + file nil 'nomesg nil 'binary) (message "Viewing with %s" method) (unwind-protect (setq process --- gnus-agent.el 1998/11/23 05:51:10 1.1 +++ gnus-agent.el 1998/11/24 08:26:21 @@ -92,7 +92,7 @@ (defvar gnus-agent-spam-hashtb nil) (defvar gnus-agent-file-name nil) (defvar gnus-agent-send-mail-function nil) -(defvar gnus-agent-file-coding-system 'no-conversion) +(defvar gnus-agent-file-coding-system 'binary) (defconst gnus-agent-scoreable-headers (list