procmail
[Top] [All Lists]

Re: removing whitespace between adjacent 'encoded-word's

2004-12-18 19:09:52
On Wed, 15 Dec 2004, 19:19 GMT+01 Ruud H.G. van Tol wrote:

Toen wij Robert Allerstorfer kietelden, kwam er dit uit:

Instead of [-a-z0-9]+ I am using
av_CHARSET = "([a-z]+[_-]?[a-z0-9-]+)"
# covers encodings like iso-8859-15 iso-8859-8-i us-ascii gb2312
shift_jis

Yes, that is better. An alternative is to just add the underscore
[-a-z0-9_]+

See http://www.professional.org/procmail/furrin.rc for several charsets
that will not match even your regex, like those with two underscores in
them.

But my regex matches all the W3C approved character Encoding names
(charsets), as listed on
http://validator.w3.org/detailed.html

Suggestion:   av_CHARSET = '([a-z][a-z0-9_-]+[a-z0-9])'
(single quotes, because no variables have to be expanded)

Could you please give an example which charset this regex catches, but
would not be catched by the regex I am currently using?

Regarding using single quotes instead of double quotes when there is
no variable expansion, I don't see a disadvantage in using double
quotes. This way, I am prepared should I ever want to add something
like $WS into it, without the need of changing the quotation
characters. If you prefer single quotes, why don't you use

SPACE = ' '

instead of

SPACE = " "

?

Where you use it, you have parts like (b|q) and [^\?].  There is no
need to be that verbose: [bq] and [^?] are as good or better ways
to express the same.

Thank you very much for looking into my SoftlabsAV 0.8.2 and making
some suggestions. Your suggestions are always very high valued, and
most of them (if not all) have been very useful. I have already
simplified all occurencies of (b|q) to [bq] (saving one byte ;-)), to
be found in SoftlabsAV starting with version 0.8.3 (not released yet).
I Also removed the backslash escaping of the ? within the character
class.

There are points where you only use ^ to anchor to the start of
a variable-value. Remember: ^ is any linefeed, ^^ is the start.

Yes, this was inconsequent. I have been using both ^^ and ^ to anchor
the start of a variable's value, I also cleaned this up for SoftlabsAV
0.8.3. However, this was not a real must because the variable values
in question are all one-liners, so using ^^ or ^ at the beginning of
the regex for such variables has exactly the same effect.

In your procmailrc, you set the logfile before DROPPRIVS,
and call chown. Another approach:

   LOGFILE = $_.log
   :
   DROPPRIVS = yes
   LOGFILE   = $MAILDIR/procmail.log

I do that because I prefer to use

LOGFILE = /var/spool/mail/$LOGNAME.log

(my etc/procmailrc has this included as an option which is commented
out). Thus, I must set LOGFILE before DROPPRIVS, to ensure it can be
created should it not exist. The chown is then required to be able for
continuing using the same log file when procmail is running as
$LOGNAME. I don't want a logfile directly in the /etc directory - this
place is too hot for me to fill it with potential trash.

I looked into how you merged my bq-code with your project, and saw
that you added the tilde to $asc. There were unexpected side-effects
with that, but I can't remember which. Consider yourself warned. :)

I wanted to inform you about this replacement earlier (was still in my
head's to-do-list). Without this replacement (s/ /~/ in line 3 of your
7 $asc lines), something like

Subject: First-=?utf-8?q?line=7E?=
 =?utf-8?q?Second-l?=ine

would result in a Subject: value of

First-line Second-line

instead of

First-line~Second-line

Did not observe any problems with the tilde. Would vote for shipping
your asc.inc with support of decoding the tilde, or, at least
commenting why you don't support it. Too bad that you can't remember
which side-effects this could cause.

BTW, your bq recipe rocks! In fact I haven't seen a procmail recipe so
far that is more sophisticated than your 'b64.inc.inc' and
'qpr.inc.inc'. Do you still have in mind to expand b64's capabilities
from decoding 4 characters at a time to do it line by line, so it
could be a real replacement to mimencode? I remember you mentioned
something when you released your very first version.

best,
rob.


____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>