#!/usr/local/bin/perl5.8.5 use strict; use MIME::WordDecoder; my $field='From: =?koi8-r?B?7s/Xb2PUdSDT1NLBeG/Xwc7J0Q==?= '; my $decoded = unmime( $field ); print $decoded #### ./decode.pl ignoring text in character set `KOI8-R' at ./decode.pl line 7 From: 1 #### $ python2.3 Python 2.3.4 (#1, Aug 3 2004, 16:01:36) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-110)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from email.Header import Header >>> from email.Header import decode_header >>> h='From: =?koi8-r?B?7s/Xb2PUdSDT1NLBeG/Xwc7J0Q==?= ' >>> decode_header( h ) [('From:', None), ('\xee\xcf\xd7oc\xd4u \xd3\xd4\xd2\xc1xo\xd7\xc1\xce\xc9\xd1', 'koi8-r'), ('', None)] >>> h = Header('\xee\xcf\xd7oc\xd4u \xd3\xd4\xd2\xc1xo\xd7\xc1\xce\xc9\xd1', 'koi8-r') >>> print h =?koi8-r?b?7s/Xb2PUdSDT1NLBeG/Xwc7J0Q==?= >>>