From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.user/1861 Path: news.gmane.org!not-for-mail From: Kjetil Torgrim Homme Newsgroups: gmane.emacs.gnus.user Subject: Re: mime QP and B headers in body Date: 13 Jan 2003 08:32:52 +0100 Organization: Dept. of Informatics, Univ. of Oslo, Norway Message-ID: <1rel7hjyhn.fsf@glesvat.ifi.uio.no> References: <87wulax72k.fsf@jidanni.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1138668501 12985 80.91.229.2 (31 Jan 2006 00:48:21 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 31 Jan 2006 00:48:21 +0000 (UTC) Original-X-From: nobody Tue Jan 17 17:29:48 2006 Original-Path: quimby.gnus.org!newsfeed1.e.nsc.no!nsc.no!nextra.com!uio.no!nntp.uio.no!ifi.uio.no!not-for-mail Original-Newsgroups: gnu.emacs.gnus,gmane.linux.debian.user.chinese.big5,comp.mail.mime Original-NNTP-Posting-Host: glesvat.ifi.uio.no Original-X-Trace: maud.ifi.uio.no 1042443182 13403 129.240.64.22 (13 Jan 2003 07:33:02 GMT) Original-X-Complaints-To: abuse@ifi.uio.no Original-NNTP-Posting-Date: 13 Jan 2003 07:33:02 GMT User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 Original-Xref: bridgekeeper.physik.uni-ulm.de gnus-emacs-gnus:2001 Original-Lines: 60 X-Gnus-Article-Number: 2001 Tue Jan 17 17:29:48 2006 Xref: news.gmane.org gmane.emacs.gnus.user:1861 Archived-At: [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 () { $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