Gnus development mailing list
 help / color / mirror / Atom feed
* Quoting RFC2047-encoded words
@ 2002-01-06 23:14 Bjørn Mork
  2002-01-08  5:17 ` ShengHuo ZHU
  0 siblings, 1 reply; 2+ messages in thread
From: Bjørn Mork @ 2002-01-06 23:14 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1757 bytes --]

This is a typical Gnus generated From field, based on address and name
from the user- variables and from posting styles:

  From: "=?iso-8859-1?q?Bj=F8rn?= Mork" <bmork@dod.no>

But RFC2047 says "An 'encoded-word' MUST NOT appear within a
'quoted-string'.", so Gnus is violating RFC2047. The problem seems to
be this part of code in message-make-from:

	;; Look for a character that cannot appear unquoted
	;; according to RFC 822.
	(when (re-search-forward "[^- !#-'*+/-9=?A-Z^-~]" nil 1)
	  ;; Quote fullname, escaping specials.
	  (goto-char (point-min))
	  (insert "\"")
	  (while (re-search-forward "[\"\\]" nil 1)
	    (replace-match "\\\\\\&" t))

As it states, this is (or was) necessary to avoid violating RFC822.
The problem is that the header may or may not be encoded at a later
stage, making it conform to RFC822 without the quotes. I wonder if the
proper way to fix it is just to remove the above code from
message-make-from, leaving the possible violation up to the user
through gnus-group-posting-charset-alist and user-full-name. AFAIK,
the current defaults will not violate RFC2822 

I just cannot see an easy way for Gnus to automatically decide whether
the quotes should be added or not. It is not possible to do it at the
time the header is generated, and later modifications should really be
up to the user IMHO.

So how about just removing that offending part of message-make-from?
Simple patch attached.

(another problem is that if the user provides a quoted-string as part
of a From or To header field, then Gnus should properly RFC2047 encode
it. Which I believe means that the quoted-string must be treated as an
atom by the encoder. I'm too lisp-illiterate to fix this I'm afraid)


Bjørn
-- 
Your ten-incher is great, right?  

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: message.patch --]
[-- Type: text/x-patch, Size: 844 bytes --]

Index: lisp/message.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/message.el,v
retrieving revision 6.185
diff -u -r6.185 message.el
--- lisp/message.el	2002/01/06 19:09:00	6.185
+++ lisp/message.el	2002/01/06 23:11:18
@@ -3732,16 +3732,6 @@
 			 (aset tmp (1- (match-end 0)) ?-))
 		       (string-match "[\\()]" tmp)))))
 	(insert fullname)
-	(goto-char (point-min))
-	;; Look for a character that cannot appear unquoted
-	;; according to RFC 822.
-	(when (re-search-forward "[^- !#-'*+/-9=?A-Z^-~]" nil 1)
-	  ;; Quote fullname, escaping specials.
-	  (goto-char (point-min))
-	  (insert "\"")
-	  (while (re-search-forward "[\"\\]" nil 1)
-	    (replace-match "\\\\\\&" t))
-	  (insert "\""))
 	(insert " <" login ">"))
        (t				; 'parens or default
 	(insert login " (")

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Quoting RFC2047-encoded words
  2002-01-06 23:14 Quoting RFC2047-encoded words Bjørn Mork
@ 2002-01-08  5:17 ` ShengHuo ZHU
  0 siblings, 0 replies; 2+ messages in thread
From: ShengHuo ZHU @ 2002-01-08  5:17 UTC (permalink / raw)


Bjørn Mork <bmork@dod.no> writes:

[...]

> So how about just removing that offending part of message-make-from?
> Simple patch attached.

Patch is installed.

ShengHuo



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-01-08  5:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-06 23:14 Quoting RFC2047-encoded words Bjørn Mork
2002-01-08  5:17 ` ShengHuo ZHU

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 NNTP newsgroup(s).