<<< Date Index >>>     <<< Thread Index >>>

Re: How does mutt choose charset encoding when sending messages?



On Monday, March 20 at 09:06 PM, quoth Kai Wang:
When I compose those messages I save the file in iso8859-1 charset in the editor(emacs). However, mutt still choose gb2312 charset for the message to send. It seems that in this situation mutt completely ignored the "send_charset" variable?

Why did this happen?

Mutt runs your message through iconv to determine which charset it is. It does something like this:

   for charset in $send_charset; do
       utf8str=`iconv -f $charset -t utf-8 $message`
       if [ $? == 0 ]; then
           break;
       fi
   done

So, if your send_charset variable is iso-8859-1:us-ascii:gb2312 then it will first try to convert your message to utf-8 from iso-8859-1 with iconv. If iconv finds any character sequences that are illegal in the iso-8859-1 character set (and thus reports an error), mutt will go on to the next charset in send_charset, and will try again.

If emacs and iconv are disagreeing about what makes an iso-8859-1 document, see if you can create a minimal file that emacs thinks is correctly coded but that iconv says is not correctly coded, and send it to the emacs developers.

~Kyle
--
A man cannot be held responsible for what his mind does while he's asleep.
                                                     -- Jean Luc Picard

Attachment: pgp1YJLBp1jAZ.pgp
Description: PGP signature