unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Kenichi Handa <handa@m17n.org>
Cc: id.brep@gmail.com, rms@gnu.org, emacs-devel@gnu.org
Subject: Re: gnus doesn't encode non-ascii attachment filenames
Date: Thu, 23 Mar 2006 14:58:51 +0900	[thread overview]
Message-ID: <E1FMIqR-0005oE-00@etlken> (raw)
In-Reply-To: <buo64ni392v.fsf@dhapc248.dev.necel.com> (message from Miles Bader on Tue, 14 Feb 2006 12:36:40 +0900)

I'm sorry for the late response on this matter.

In article <buo64ni392v.fsf@dhapc248.dev.necel.com>, Miles Bader <miles.bader@necel.com> writes:

> Kenichi Handa <handa@m17n.org> 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  <handa@m17n.org>

	* 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

      parent reply	other threads:[~2006-03-23  5:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-13  7:00 gnus doesn't encode non-ascii attachment filenames Zhang Wei
     [not found] ` <E1F8oEg-0007Q6-Vf@fencepost.gnu.org>
2006-02-14  1:25   ` Zhang Wei
2006-02-14  2:13     ` Kenichi Handa
2006-02-14  3:36       ` Miles Bader
2006-02-14 10:59         ` Gnus compatibility with Emacs 23 (unicode branch) (was: gnus doesn't encode non-ascii attachment filenames) Reiner Steib
2006-02-23 21:03           ` Gnus compatibility with Emacs 23 (unicode branch) Reiner Steib
2006-03-23  5:58         ` Kenichi Handa [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1FMIqR-0005oE-00@etlken \
    --to=handa@m17n.org \
    --cc=emacs-devel@gnu.org \
    --cc=id.brep@gmail.com \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).