Frank da Cruz scripsit:

> Is anybody aware of a Unix stdin/stdout application (suitable for
> piping) that converts a text stream from one character encoding to
> another based on its MIME headers (as you would find, for example, in
> an email message)?  

The following script is not bulletproof, but it should work in most cases:

#!/bin/sh
TMP=/tmp/mime-recode-$$
cat >$TMP
CHARSET=`perl -ne 'print "$1\n" if /^Content-Type:.*charset="([^"]*)/i' <$TMP`
iconv -f $CHARSET <$TMP

-- 
Winter:  MIT,                                   John Cowan
Keio, INRIA,                                    [EMAIL PROTECTED]
Issue lots of Drafts.                           http://www.ccil.org/~cowan
So much more to understand!                     http://www.reutershealth.com
Might simplicity return?                        (A "tanka", or extended haiku)

Reply via email to