How to send with charset=iso-8859-1 instead of unknown-8bit?
mutt at raf.org
mutt at raf.org
Thu Jun 21 00:42:58 UTC 2018
Ian Zimmerman wrote:
> On 2018-06-20 12:16, mutt at raf.org wrote:
>
> > I have some software that invokes mutt (non-interactively) to
> > send email with iso-8859-1 body text.
>
> My guess is that mutt looks at the locale environment (LANG and LC_*) to
> set the encoding of the source data, and tries to recode it into one
> of the encodings in send_charset.
>
> If you _know_ your data is iso-8859-1 but your LANG etc. is something
> else, try changing LANG locally in your driver script/program.
Thanks. I'll try that. Mutt probably detects that it isn't valid utf-8,
and so doesn't match the system locale, and so can't be converted.
That would make sense.
I wonder if setting charset to iso-8859-1 would also fix it.
That's for the terminal so it's probably not wise to change that.
Maybe assumed_charset? (maybe that's only for incoming messages).
I ran some tests and setting LANG=en_AU.iso88591 fixes it.
So does setting charset=iso-8859-1 in .muttrc.
But setting assumed_charset or send_charset doesn't fix it.
Strangely, when I perform these tests, when it gets it "wrong",
it's using utf-8 as the character set rather than unknown-8bit.
I don't understand that but it's OK. It is as a different user.
That might have something to do with it. The user producing the
unknown-8bit emails did have send_charset=us-ascii:iso-8859-1
in their .muttrc (I'd forgotten) but the user performing these
tests didn't).
The main thing is that I now have two ways to fix the problem.
I think setting LANG when sending the mail as you suggest is the
best method (and leaving charset as it is so that it matches the
terminal for when reading mail later).
Thanks again.
> BTW, running mutt non-interactively has always seemed strange to me.
> Why not use something simpler like mailx, or even /usr/sbin/sendmail?
Because they don't know about ~/.muttrc or mutt's -e option :-)
Mainly, I want mutt to keep a record of outgoing mail in an mbox
that I might need to examine later, and I'll be using mutt when I do.
If I ever need to send encrypted mail programmatically, I'd probably
want to do that via mutt as well.
cheers,
raf
More information about the Mutt-users
mailing list