[Top][All Lists]

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


From: Stephen J. Turnbull
Subject: rfc2047-decode-region
Date: Sat, 31 Dec 2011 21:48:44 +0900

Eli Zaretskii writes:
 > This function accepts an optional ADDRESS-MIME argument, which is
 > described in the doc string thusly:
 >   If ADDRESS-MIME is non-nil, strip backslashes which precede characters
 >   other than `"' and `\' in quoted strings.
 > This gives absolutely no information about when to use this option and
 > why.

It's all in RFC 5322.  Doesn't everybody know that by heart? ;-)

 > The emacs-mime manual doesn't even mention this argument.

A "quoted string" in RFC 5322 is a string of printing ASCII
characters, excluding the backslash and the double quote, plus SPC,
TAB, and CRLF pairs enclosed in double quotes.  The backslash is a
no-op (ie, treated as not present) in such a quoted string except when
followed immediately by another backslash or a double quote.  The CRLF
is also a no-op (ie, used for folding).

Quoted strings are treated as "atoms", which are mostly of interest in
address parsing, thus the name, I guess.  MIME doesn't have anything
to do with it AFAICS; this definition is from the RFC 822 family.
Probably a better name would be "canonicalize-quoted-strings", since
it's not actually decoding them (that would involve translating
quoted-pairs of \\ and \" to \ and " respectively, and stripping out
CRLF pairs).

I think this behavior is actually broken, since rfc2047-encode-region
cannot know if any given string has been treated with ADDRESS-MIME
(and so the \\ and \" pairs should not be quoted to \\\\ and \\\"), or
not (in which ase they should be so quoted).  It probably doesn't
matter, though: uless somebody wants to deliberately screw you up
those pairs are very unlikely to occur in a raw string.

I would assume that this argument should be non-nil when decoding a
header field which is parsed into atoms, such as To or From.  Possibly
this would apply to Message-ID and References as well (in messages
conforming to RFC 5322 and maybe 2822, but in 822 References and
In-Reply-To were just unstructured text).

reply via email to

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