[gnus git] branch master updated: n0-17-496-gb51a31d =1= Don't fold filename="..." parameters when doing rfc2047 encoding

Lars Ingebrigtsen <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  b51a31dcb469849c4d4f0e6c62adfca5d7da4e41 (commit)
      from  cfc30889cae978ef0626d7fd965eb28847188ad8 (commit)


- Log -----------------------------------------------------------------
commit b51a31dcb469849c4d4f0e6c62adfca5d7da4e41
Author: Lars Ingebrigtsen <[email protected]>
Date:   Mon Jan 30 23:40:56 2012 +0100

    Don't fold filename="..." parameters when doing rfc2047 encoding
    
    See bug#10587 for details.
    
    * rfc2047.el (rfc2047-encode-region): Allow not folding the encoded
    words.
    (rfc2047-encode-string): Ditto.
    (rfc2047-encode-parameter): Don't fold parameters.  Some MUAs do not
    understand folded filename="..." parameters, for instance.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9482eb3..9483e4f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,11 @@
 2012-01-30  Lars Ingebrigtsen  <[email protected]>
 
+	* rfc2047.el (rfc2047-encode-region): Allow not folding the encoded
+	words.
+	(rfc2047-encode-string): Ditto.
+	(rfc2047-encode-parameter): Don't fold parameters.  Some MUAs do not
+	understand folded filename="..." parameters, for instance.
+
 	* nnimap.el (nnimap-wait-for-response): Include the imap server name in
 	the message for greater debuggability.
 
diff --git a/lisp/rfc2047.el b/lisp/rfc2047.el
index a275df7..e881256 100644
--- a/lisp/rfc2047.el
+++ b/lisp/rfc2047.el
@@ -362,7 +362,7 @@ The buffer may be narrowed."
     (modify-syntax-entry ?@ "." table)
     table))
 
-(defun rfc2047-encode-region (b e)
+(defun rfc2047-encode-region (b e &optional dont-fold)
   "Encode words in region B to E that need encoding.
 By default, the region is treated as containing RFC2822 addresses.
 Dynamically bind `rfc2047-encoding-type' to change that."
@@ -546,16 +546,17 @@ Dynamically bind `rfc2047-encoding-type' to change that."
 		 (signal (car err) (cdr err))
 	       (error "Invalid data for rfc2047 encoding: %s"
 		      (mm-replace-in-string orig-text "[ \t\n]+" " "))))))))
-    (rfc2047-fold-region b (point))
+    (unless dont-fold
+      (rfc2047-fold-region b (point)))
     (goto-char (point-max))))
 
-(defun rfc2047-encode-string (string)
+(defun rfc2047-encode-string (string &optional dont-fold)
   "Encode words in STRING.
 By default, the string is treated as containing addresses (see
 `rfc2047-encoding-type')."
   (mm-with-multibyte-buffer
     (insert string)
-    (rfc2047-encode-region (point-min) (point-max))
+    (rfc2047-encode-region (point-min) (point-max) dont-fold)
     (buffer-string)))
 
 ;; From RFC 2047:
@@ -850,7 +851,7 @@ This is a substitution for the `rfc2231-encode-string' function, that
 is the standard but many mailers don't support it."
   (let ((rfc2047-encoding-type 'mime)
 	(rfc2047-encode-max-chars nil))
-    (rfc2045-encode-string param (rfc2047-encode-string value))))
+    (rfc2045-encode-string param (rfc2047-encode-string value t))))
 
 ;;;
 ;;; Functions for decoding RFC2047 messages

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/ChangeLog  |    6 ++++++
 lisp/rfc2047.el |   11 ++++++-----
 2 files changed, 12 insertions(+), 5 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.