[Top][All Lists]

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

Re: [Nmh-workers] Patch: parse RFC-2822 quoted-string and quoted-pair

From: Robert Elz
Subject: Re: [Nmh-workers] Patch: parse RFC-2822 quoted-string and quoted-pair
Date: Tue, 16 Dec 2003 13:08:06 +0700

    Date:        Mon, 15 Dec 2003 14:20:41 -0500
    From:        Carl Mummert <address@hidden>
    Message-ID:  <address@hidden>

  | I coded an mh-format function "unquote" to
  | remove balanced single and double quotes (a slight generalization of
  | quoted-string)

A generalisation yes, but an incorrect one - single quotes are not
special in 822, and don't want to be, things like O'Toole are perfectly
valid names for people to have.  What's more, a name field may have
two people with ' characters in their names (O'Toole & O'Sullivan)
which shouldn't turn into OToole & OSullivan)   Only " quotes strings,
' is just a character.

I have a half suspicion that an (incorrect, but still possible) lone \
at the end of the string might break your code too (just from reading it).

The algorithm could probably also be improved, there's no need to find
and remove the closing " in a string, and then go back and process it
all again - just copy to the output buffer while seeking the ".  Quoted
strings don't nest (and with just one quoting character, they cannot),
there's no need to allow for that possibility.


reply via email to

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