Fixing unreadable email with mutt and vim

Mutt is my mail client of choice. The reasons are simple: It...

  • is fast

  • is usable from the command line (a big plus)

  • lets you do essentially anything to a message

  • supports hooks for very flexible configuraiton



And the tip of the day -- how to fix unreadable (as in -- mojibake mail) to be readable again.


  1. Highlight the mail in the index and press "e". This will fire up your editor (vim in my case) and load the full mail in it.

  2. Find the "Content-Type" header. Edit the value of the "charset" field on the line. If there is no such header just add one:
    Content-Type: text/plain; charset="iso-2022-jp"


If the subject of the mail is also unreadable, do the following:

  1. Install maildrop

  2. Select the Subject line and pass it to this command
    cat | xargs -ifoo reformime -h "foo" | iconv -f iso-2022-jp -t utf8 | xargs -ibar reformime -o "bar" -c utf8
    . In vim speak, this means

    1. /^\csubject:

    2. Shift-V!cat | xargs -ifoo ...


  3. Play around with the charsets if you're not getting correct results.

Comments

Popular posts from this blog

FreeIPA cluster with containers

ADSL Router Model CT-5367 user and pass (VIVACOM)

Installing Gentoo with full disk encryption