emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gnus doesn't encode non-ascii attachment filenames


From: Kenichi Handa
Subject: Re: gnus doesn't encode non-ascii attachment filenames
Date: Thu, 23 Mar 2006 14:58:51 +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)

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

In article <address@hidden>, Miles Bader <address@hidden> writes:

> Kenichi Handa <address@hidden> 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
address@hidden

2006-03-23  Kenichi Handa  <address@hidden>

        * 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]