On 23.03.10,15:24, Matthias Apitz wrote:
> 
> Hello,
> 
> Perhaps a bit off-topic, but maybe someone of the mutt-Gurus has a
> pointer for me:
> 
> I want to sendout mail the following way:
> 
>       sendmail -t < filename
> 
> where the file 'filename' contains some header lines, especially To:
>  Subject: and From:  and as well the body of the mail; all is in UTF-8
> and I know I have to encode the header lines and says something about
> the body. With Perl it goes like this:
> 
>  #!/usr/bin/perl
> 
>  use utf8;
>  use Encode;
> 
>  open (MAIL, "|/usr/lib/sendmail -t");
> 
>  $x="Subject: ... with some UTF-8 chars";
>  $x_for_header = Encode::encode('MIME-Q', $x);
> 
>  print MAIL "From: .......\n";
>  print MAIL "To: .......\n";
>  print MAIL $x_for_header."\n";
>  print MAIL "Content-type: text/xml\;charset=UTF-8\n";
>  print MAIL "Content-Transfer-Encoding: 8bit\n";
>  print MAIL "\n";
>  ... now the plain UTF-8 body follows
>  close(MAIL) || warn "Error closing mail: $!";
>  }
> 
> How can I encode the header lines (like the above Subject: line) not
> using Perl, i.e. with plain shell tools; I've checked out metamail and
> such stuff, but they don't help. Any idea? Thanks in advance
> 
>       matthias
> 


If you pipe it through "iconv" it should work, like:

iconv -f latin1 -t utf8

-- 
Jostein Berntsen <jber...@broadpark.no>

Reply via email to