From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.devel Subject: Re: gnus doesn't encode non-ascii attachment filenames Date: Thu, 23 Mar 2006 14:58:51 +0900 Message-ID: References: <87bqxbwxoq.fsf@emacsfans.org> <87irriras8.fsf@emacsfans.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII X-Trace: sea.gmane.org 1143093563 29243 80.91.229.2 (23 Mar 2006 05:59:23 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 23 Mar 2006 05:59:23 +0000 (UTC) Cc: id.brep@gmail.com, rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 23 06:59:19 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FMIqo-0005of-3u for ged-emacs-devel@m.gmane.org; Thu, 23 Mar 2006 06:59:14 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FMIqn-00072A-Ml for ged-emacs-devel@m.gmane.org; Thu, 23 Mar 2006 00:59:13 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FMIqb-000723-5O for emacs-devel@gnu.org; Thu, 23 Mar 2006 00:59:01 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FMIqa-00071r-2G for emacs-devel@gnu.org; Thu, 23 Mar 2006 00:59:00 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FMIqZ-00071o-VF for emacs-devel@gnu.org; Thu, 23 Mar 2006 00:58:59 -0500 Original-Received: from [192.47.44.130] (helo=tsukuba.m17n.org) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FMIr4-0002E5-7h; Thu, 23 Mar 2006 00:59:30 -0500 Original-Received: from nfs.m17n.org (nfs.m17n.org [192.47.44.7]) by tsukuba.m17n.org (8.13.4/8.13.4/Debian-3) with ESMTP id k2N5wqPx029627; Thu, 23 Mar 2006 14:58:52 +0900 Original-Received: from etlken (etlken.m17n.org [192.47.44.125]) by nfs.m17n.org (8.13.4/8.13.4/Debian-3) with ESMTP id k2N5wq0m019994; Thu, 23 Mar 2006 14:58:52 +0900 Original-Received: from handa by etlken with local (Exim 3.36 #1 (Debian)) id 1FMIqR-0005oE-00; Thu, 23 Mar 2006 14:58:51 +0900 Original-To: Miles Bader In-reply-to: (message from Miles Bader on Tue, 14 Feb 2006 12:36:40 +0900) User-Agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/22.0.50 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:51985 Archived-At: I'm sorry for the late response on this matter. In article , Miles Bader writes: > Kenichi Handa writes: >> For Emacs 23, we can have a better/simpler fix. But, could someone >> tell me the maintenance policy of Gnus codes? Should we modify codes >> in cvs HEAD so that it works also with emacs-unicode-2 (perhaps with >> version check here and there)? Or, should we directly modify codes in >> cvs emacs-unicode-2? > It seems to me better keep the code in both branches the same, if > possible. > Changes to Emacs 22 will be propagated to Gnus 5.10 and the Gnus > development branch (No Gnus); as people may wish to use the Gnus > development branch with Emacs 23, it would be a good thing to avoid > changes which are only in the Emacs 23 sources. I've just installed the attached change in HEAD (it doesn't check versions nor existence of a specific function). But, as I'm not using Gnus, could Gnus users please check if it doesn't break anything? To Emacs 23 users; the change will be propagated to Emacs 23 in a week or so. If you can't wait for that, please apply the patch by yourself and check if it fixes the current problem. --- Kenichi Handa handa@m17n.org 2006-03-23 Kenichi Handa * rfc2231.el (rfc2231-decode-encoded-string): Work on unibyte buffer and then decode the buffer text if necessary. (rfc2231-encode-string): Be sure to work on multibyte buffer at first, and after mm-encode-body, change the buffer to unibyte. *** rfc2231.el 20 Feb 2006 09:51:27 +0900 1.4.14.11 --- rfc2231.el 22 Mar 2006 22:07:21 +0900 *************** *** 227,233 **** (let ((coding-system (mm-charset-to-coding-system (match-string 2 string))) ;;(language (match-string 3 string)) (value (match-string 4 string))) ! (mm-with-multibyte-buffer (insert value) (goto-char (point-min)) (while (search-forward "%" nil t) --- 227,233 ---- (let ((coding-system (mm-charset-to-coding-system (match-string 2 string))) ;;(language (match-string 3 string)) (value (match-string 4 string))) ! (mm-with-unibyte-buffer (insert value) (goto-char (point-min)) (while (search-forward "%" nil t) *************** *** 236,244 **** (string-to-number (buffer-substring (point) (+ (point) 2)) 16) (delete-region (1- (point)) (+ (point) 2))))) ;; Decode using the charset, if any. ! (unless (memq coding-system '(nil ascii)) ! (mm-decode-coding-region (point-min) (point-max) coding-system)) ! (buffer-string)))) (defun rfc2231-encode-string (param value) "Return and PARAM=VALUE string encoded according to RFC2231. --- 236,244 ---- (string-to-number (buffer-substring (point) (+ (point) 2)) 16) (delete-region (1- (point)) (+ (point) 2))))) ;; Decode using the charset, if any. ! (if (memq coding-system '(nil ascii)) ! (buffer-string) ! (mm-decode-coding-string (buffer-string) coding-system))))) (defun rfc2231-encode-string (param value) "Return and PARAM=VALUE string encoded according to RFC2231. *************** *** 252,258 **** ;; Don't make lines exceeding 76 column. (limit (- 74 (length param))) spacep encodep charsetp charset broken) ! (with-temp-buffer (insert value) (goto-char (point-min)) (while (not (eobp)) --- 252,258 ---- ;; Don't make lines exceeding 76 column. (limit (- 74 (length param))) spacep encodep charsetp charset broken) ! (mm-with-multibyte-buffer (insert value) (goto-char (point-min)) (while (not (eobp)) *************** *** 268,273 **** --- 268,274 ---- (forward-char 1)) (when charsetp (setq charset (mm-encode-body))) + (set-buffer-multibyte nil) (cond ((or encodep charsetp (progn