* Re: mime QP and B headers in body [not found] <871y3i7pcj.fsf@jidanni.org> @ 2003-01-12 11:26 ` Lars Magne Ingebrigtsen 2003-01-15 8:18 ` Dan Jacobson 1 sibling, 0 replies; 3+ messages in thread From: Lars Magne Ingebrigtsen @ 2003-01-12 11:26 UTC (permalink / raw) Dan Jacobson <jidanni@dman.ddts.net> writes: > I make a daily spam report and send it to myself in the body of a mail message: > > * Subject: =?BIG5?B?ttmhS... > * Subject:=?big5?Q?=A7A=B... > * Subject: Want a BIG Pen... > * Subject: =?GB2312?B?1tC... > * Subject: =?ISO-8859-1?B... How do you construct these reports? If you normalized all the charsets to, say, iso-2022-* or utf-8, that would probably make it easier to read. > But that is rather inconvenient. Does anyone have a better way? > Probably I need to make a multi part mime message that I can read in > gnus. That would also work. -- (domestic pets only, the antidote for overdose, milk.) larsi@gnus.org * Lars Magne Ingebrigtsen ^ permalink raw reply [flat|nested] 3+ messages in thread
* mime QP and B headers in body [not found] <871y3i7pcj.fsf@jidanni.org> 2003-01-12 11:26 ` mime QP and B headers in body Lars Magne Ingebrigtsen @ 2003-01-15 8:18 ` Dan Jacobson 1 sibling, 0 replies; 3+ messages in thread From: Dan Jacobson @ 2003-01-15 8:18 UTC (permalink / raw) >I make a daily spam report and send it to myself in the body of a mail message: > Subject: =?BIG5?B?ttmhS... > Subject:=?big5?Q?=A7A=B... > Subject: Want a BIG Pen... > Subject: =?GB2312?B?1tC... > Subject: =?ISO-8859-1?B... the reply posted didn't work because my perl doesn't have concat() or something. Here's another approach my $bdy='----=_NextPart_'.rand(); print ' This is a multi-part message in MIME format. '.$bdy.' Content-Type: multipart/alternative; boundary="'.$bdy.'"' s/=\?([-a-z0-9]*)\?([BQ])\?([^?]*)\?=/$bdy . '\ Content-Type: text\/plain;\ charset="'.$1.'"\ Content-Transfer-Encoding: '.if($2=='Q'){'"quoted-printable"'}elif\ ($2=='B'){'"base64"'}.'\ '.$3.'\ \ '.$bdy/e; Unfortunately my perl is bad so someone help me maybe. The idea is to simple turn the =? seperator sequence into the larger style seperator sequence. ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <87wulax72k.fsf@jidanni.org>]
* Re: mime QP and B headers in body [not found] <87wulax72k.fsf@jidanni.org> @ 2003-01-13 7:32 ` Kjetil Torgrim Homme 0 siblings, 0 replies; 3+ messages in thread From: Kjetil Torgrim Homme @ 2003-01-13 7:32 UTC (permalink / raw) [Dan Jacobson]: > > > I make a daily spam report > > * Subject: =?BIG5?B?ttmhS... > > * Subject:=?big5?Q?=A7A=B... > > * Subject: Want a BIG Pen... > > * Subject: =?GB2312?B?1tC... > > * Subject: =?ISO-8859-1?B... > > If you normalized all the charsets to, say, iso-2022-* or utf-8, that > would probably make it easier to read. > > i could make a big program to make them all utf-8 which would > involve a lot of sed and awk and iconv which is very picky and i > dare not complain about lest i have another encounter with drepper please quote properly! it's not that hard to do: #! /usr/bin/perl -w use MIME::Base64; use MIME::QuotedPrint; sub recode { my ($charset) = shift; my $tmp = "/tmp/reco.$$"; open (TMP, ">$tmp") || die; print TMP @_; close (TMP); my $ans = ""; print "recode $charset..UTF8 < $tmp\n"; open (RECODE, "recode <$tmp $charset..UTF8|") || die; while (<RECODE>) { $ans .= $_; } unlink ($tmp); $ans; } while (<>) { if (/=\?(\S+?)\?B\?(\S+)\?=/i) { my ($charset, $word) = ($1, $2); print recode ($charset, decode_base64 ($word)), "\n"; } elsif (/=\?(\S+?)\?Q\?(\S+)\?=/i) { my ($charset, $word) = ($1, $2); $word =~ tr/_/ /; print recode ($charset, decode_qp ($word)), "\n"; } else { print; } } oh, duh, this only decodes the first quoted-word on each line. consider it an exercise for the reader. -- Kjetil T. | read and make up your own mind | http://www.cactus48.com/truth.html ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-01-15 8:18 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <871y3i7pcj.fsf@jidanni.org> 2003-01-12 11:26 ` mime QP and B headers in body Lars Magne Ingebrigtsen 2003-01-15 8:18 ` Dan Jacobson [not found] <87wulax72k.fsf@jidanni.org> 2003-01-13 7:32 ` Kjetil Torgrim Homme
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).