This is the mail archive of the gnats-devel@sources.redhat.com mailing list for the GNATS project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

GNATS and MIME


This went to bug-gnats yesterday, but I'm sending this to gnats-devel as 
well, since it contains a request for volunteers to look into a problem 
(see the end of the message).

Anyone out there with a little bit of coding experience and a tiny bit of 
spare time?

At 17:01 19.02.2001 +0100, Palle Girgensohn wrote:
>Hi!
>
>Has anyone tried to get gnats to behave more politely with
>MIMEified mails. Now, it will not work at all if the subject is
>mimified (by for example, correctly embedding Swedish едц
>characters with ?ISO?8859... stuff). Also, messages can look
>pretty ugly, with lots of '=E5' for every д etc...
>
>I'm running 3.113. Will this behave better in version 4? Has
>anyone patched gnats?
>
>/Palle

Use a script to translate quoted printables. The following little Perl 
script does this (yes, it might be tad unelegant, but it works):

#########################
#!/usr/bin/perl

use MIME::QuotedPrint ();
while (<>) {
   $line = $_;
   $line =~ s/=\?iso-8859-1\?Q\?//i;
   $line =~ s/\?=//g;

   if ($line =~ /^Subject/ ) {
       $line =~ tr/_/ /;
   };

   if ($line =~ /^From/ ) {
       $line =~ tr/_/ /;
   };

   $line = MIME::QuotedPrint::decode($line);

   print $line;
};

########################

Then set up the mail alias which receives bug reports to pipe messages 
through this script before it is piped into queue-pr. Like this:

| /path-to-script/script.pl | /usr/local/libexec/gnats/queue-pr -q

Warning: this seems to break recognition of PR numbers when people reply by 
mail to PRs. I believe this to be because the routine in file-pr that 
handles mail subject recognition breaks down when it encounters anything 
beyond 7-bit ASCII. The consequence is that if a PR that has such 
characters in the Subject is replied to by mail, file-pr will create a new 
problem report with a new number. A workaround is to remove the qp 
translation of the Subject line in the script above.

I haven't looked at the Subject recognition problem, so if someone else 
would care to take a peek at file-pr.c and see if they can find a solution, 
I'd be thankful.

Yngve Svendsen
IS Engineer
Clustra AS, Trondheim, Norway
yngve.svendsen@clustra.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]