Skip to content
Solar Account.
Education & Software

How to Set Language and Locale Settings in Mutt for Email Display

To set language and character display settings in Mutt (or NeoMutt), you must align your Linux/Unix system locale variables with your ~/.muttrc configuration. Setting your system environment variable LANG="en_US.UTF-8" (or your preferred language code) and pla...

How to Set Language and Locale Settings in Mutt for Email Display

To set language and character display settings in Mutt (or NeoMutt), you must align your Linux/Unix system locale variables with your ~/.muttrc configuration. Setting your system environment variable LANG="en_US.UTF-8" (or your preferred language code) and placing set charset = "utf-8" alongside set assumed_charset inside your ~/.muttrc file ensures Mutt renders email bodies, dates, and non-ASCII character sets cleanly without displaying corrupted text.

Contents

Understanding How Mutt Handles Language and Character Encodings

Mutt is a text-based email client designed for Unix-like environments. Unlike modern graphic email clients that maintain independent graphical language engines, Mutt relies on your terminal environment, operating system locale, and internal configuration directives to format text. Language display in Mutt covers two primary areas: human language localization (such as date formats, system messages, and interface strings) and character set rendering (such as displaying UTF-8, ISO-8859-1, or Windows-1252 encoded message bodies).

When Mutt opens an email message, it reads the MIME header (Content-Type: text/plain; charset="...") to determine how the body text was encoded by the sender's mail software. It then uses your terminal environment's character set to convert and display those characters using the system library function iconv. If your terminal is using a UTF-8 character set but Mutt is configured to expect ISO-8859-1—or if the incoming email lacks a valid MIME charset header entirely—the terminal displays unreadable characters, commonly known as mojibake (e.g., replacement boxes, unparsed octal codes, or upside-down question marks).

Localization also dictates how date headers (Date:) and client interface prompts appear. Mutt derives its date display formats and UI string language from standard POSIX environment variables, specifically LANG, LC_ALL, LC_CTYPE, and LC_TIME. Configuring Mutt for correct language display requires adjusting both your shell environment profile and your .muttrc file.

Step 1: Configuring the System Locale Environment

How to set up OAuth2 in the Mutt email client

Before defining settings inside Mutt, your underlying shell environment must support the specific language and UTF-8 encoding you intend to use. If your shell locale is set to a legacy standard like C or POSIX, Mutt cannot render multilingual text or multi-byte UTF-8 sequences, regardless of your internal Mutt settings.

Checking Available System Locales

To see which locales are currently generated on your machine, run the following command in your terminal:

locale -a

Look for a locale matching your language and UTF-8 encoding, such as en_US.utf8, fr_FR.utf8, de_DE.utf8, or ja_JP.utf8. If your target language locale is missing, you must generate it using your system’s locale management utility:

  • On Debian/Ubuntu systems:
    sudo locale-gen en_US.UTF-8
    sudo update-locale
    
  • On Arch Linux: Uncomment the desired locale in /etc/locale.gen (e.g., en_US.UTF-8 UTF-8) and run:
    sudo locale-gen
    

Exporting Locale Variables in Shell Profiles

To make your locale environment persistent across terminal sessions, declare your language settings inside your shell configuration file (such as ~/.bashrc, ~/.zshrc, or ~/.profile).

Add the following lines to set the primary language and character set:

export LANG="en_US.UTF-8" export LC_ALL="en_US.UTF-8"

If you prefer your main interface to remain in English while displaying date formats, months, and weekdays according to a different region’s rules, set LC_TIME independently:

export LANG="en_US.UTF-8" export LC_TIME="fr_FR.UTF-8"

After updating the file, refresh your active terminal session by running source ~/.bashrc or restarting your terminal emulator.

Step 2: Configuring Display Settings in .muttrc

Once your system shell exports a valid UTF-8 locale, open your Mutt configuration file (~/.muttrc or ~/.mutt/muttrc) to declare how Mutt interprets text inputs, display outputs, and incoming messages.

# Specify the character set of your terminal set charset = "utf-8" # Specify the character set used inside your .muttrc file itself set config_charset = "utf-8" # Set the preferred character encodings for outgoing mail set send_charset = "us-ascii:iso-8859-1:utf-8"

Explaining Core Character Directives

  1. set charset: Tells Mutt the character encoding used by your current terminal emulator. When set to "utf-8", Mutt automatically translates incoming email text from the message's native encoding into UTF-8 for visual output.
  2. set config_charset: Informs Mutt how to read configuration directives inside ~/.muttrc. This prevents syntax errors or broken text when defining localized macros, hooks, or custom header strings containing non-ASCII characters directly within your configuration file.
  3. set send_charset: Controls how Mutt encodes outgoing messages. Mutt evaluates this colon-separated list from left to right. It uses the first character set capable of representing all characters in your message. For instance, plain text without accents will be sent as light us-ascii, basic Western European accents will trigger iso-8859-1, and complex unicode symbols or non-Latin scripts will fallback to utf-8.

Step 3: Handling Missing Charset Headers (assumed_charset)

A common problem when viewing older emails, automated notification scripts, or poorly configured mail clients is the omission of the MIME character set header. When an email arrives labeled simply as text/plain without a charset parameter, Mutt falls back to your local charset setting, which often fails if the sender used a regional single-byte encoding like windows-1252, iso-8859-1, or gb2312.

To prevent unreadable character rendering on unlabelled messages, configure the assumed_charset option in your ~/.muttrc:

# Define fallbacks for incoming emails missing character set declarations set assumed_charset = "iso-8859-1:windows-1252:utf-8"

For users frequently receiving emails in specific non-English regional encodings, place those encodings ahead of UTF-8 in the colon-separated string:

  • For East Asian / Chinese scripts:
    set assumed_charset = "gb2312:gbk:gb18030:utf-8"
    
  • For Cyrillic scripts:
    set assumed_charset = "koi8-r:windows-1251:utf-8"
    
  • For Japanese scripts:
    set assumed_charset = "euc-jp:shift_jis:utf-8"
    

When Mutt parses an email missing MIME character metadata, it tests the message contents against the list defined in assumed_charset sequentially until it achieves a valid character mapping.

Step 4: Localizing Date Formats and Index Displays

Mutt allows complete control over how date stamps appear in your index list (the main inbox view) and inside the message header view. Date strings rely on standard C library strftime formatting specifiers.

To customize the date display in your inbox view, use the date_format variable alongside index_format:

# Set the time and date display format (Year-Month-Day Hour:Minute) set date_format = "%Y-%m-%d %H:%M" # Incorporate localized date string formatting into the index line display set index_format = "%4C %Z %{%b %d} %-15.15F (%4c) %s"

If you wish to show full month names and day names in your localized language (e.g., displaying "Lundi" or "Montag" instead of "Monday"), verify that your shell environment exports the matching LC_TIME variable prior to launching Mutt:

export LC_TIME="de_DE.UTF-8" mutt

Mutt automatically respects LC_TIME when rendering format specifiers such as %a (abbreviated day name), %A (full day name), %b (abbreviated month name), and %B (full month name).

Summary of Mutt Display and Language Settings

The following table summarizes the key directives used to control language, locale, and character set display in Mutt:

Configuration Setting / Variable Location Primary Purpose Recommended Default Value
LANG / LC_ALL Shell (~/.bashrc) Defines global system language and default locale encoding. en_US.UTF-8
LC_TIME Shell (~/.bashrc) Sets local language formatting rules for dates and times specifically. en_US.UTF-8 (or regional locale)
set charset ~/.muttrc Sets the character set expected by your active terminal emulator. "utf-8"
set config_charset ~/.muttrc Specifies the character encoding used inside your .muttrc file. "utf-8"
set send_charset ~/.muttrc Sets preferred encodings for outgoing mail, evaluated sequentially. "us-ascii:iso-8859-1:utf-8"
set assumed_charset ~/.muttrc Provides fallback encodings for incoming mail lacking MIME headers. "iso-8859-1:windows-1252:utf-8"
set date_format ~/.muttrc Customizes date formatting strings using standard strftime syntax. "%Y-%m-%d %H:%M"

Troubleshooting Broken Email Display and Mojibake

Even with a populated .muttrc, character rendering issues can persist due to external terminal settings or external pager utilities.

WARNING: Mismatched terminal encodings will override ~/.muttrc. If your terminal emulator (e.g., tmux, Alacritty, PuTTY) is set to ISO-8859-1, setting 'set charset = "utf-8"' in Mutt will produce distorted text output regardless of your system locale settings.

1. Terminal Emulator Encodings

Ensure your terminal emulator software is set to render UTF-8.

  • If using tmux or GNU Screen, ensure the session is launched with UTF-8 flags: tmux -u.
  • If connecting over SSH, ensure your local terminal passes locale variables to the remote host. Verify this in your local SSH config (/etc/ssh/ssh_config or ~/.ssh/config) with SendEnv LANG LC_*, and ensure the remote host accepts them in /etc/ssh/sshd_config with AcceptEnv LANG LC_*.

2. External Pager Glitches (less or more)

If you use an external pager inside Mutt (such as set pager = "less"), less must be configured to pass binary raw UTF-8 sequences. Add the following export to your shell configuration file:

export LESSCHARSET="utf-8"

Alternatively, use Mutt’s built-in internal pager (set pager = "builtin"), which directly shares Mutt's internal character translation pipeline and avoids subprocess encoding mismatches.

3. Attachment Display and mailcap Filtering

When viewing HTML emails converted to text via an external tool (such as lynx, w3m, or pandoc), character rendering errors often originate in the text converter rather than Mutt itself.

Check your ~/.mailcap file and add explicit UTF-8 output flags to your text conversion commands:

text/html; w3m -I %{charset} -T text/html -cols 80 -dump; copiousoutput

Passing -I %{charset} instructs w3m to extract the exact character encoding passed directly by Mutt's MIME parser.

Frequently Asked Questions

How do I check what locale Mutt is currently using?

You can inspect Mutt’s runtime variables by pressing : inside Mutt to open the command prompt, then typing set ?charset or set ?assumed_charset and pressing Enter. Mutt displays the active value at the bottom of the screen. To check active environment variables, run :exec shell-escape followed by locale.

Why are accented or non-English characters displaying as question marks?

Question marks or octal escape sequences (e.g., \303\251) occur when Mutt receives characters that cannot be mapped to your terminal's declared character set, or when set charset in your .muttrc does not match your active terminal emulator's encoding. Ensure your shell exports LANG="en_US.UTF-8" and your .muttrc includes set charset = "utf-8".

What is the difference between charset and assumed_charset in Mutt?

charset defines the terminal emulator's local encoding, telling Mutt how to output text onto your screen. assumed_charset is a fallback list used strictly for incoming emails that fail to include a MIME character set header, allowing Mutt to guess the sender's encoding correctly.

How do I switch Mutt’s interface messages to a different language?

Mutt’s system interface messages (such as prompt texts and warning banners) rely on GNU gettext localizations. To run Mutt in another language, launch it with the LC_MESSAGES variable assigned to your preferred language locale: LC_MESSAGES=fr_FR.UTF-8 mutt.

Optimizing Your Mutt Workflow

Configuring your language and locale settings provides a consistent foundation for terminal-based email management. To verify your setup, send a test email containing non-ASCII symbols (such as accents, currency symbols, or non-Latin scripts) to yourself and inspect the raw email structure using Mutt's h (toggle headers) key.

Once your language encoding operates reliably, consider refining your workflow by combining display rules with custom color profiles, GPG key auto-signing, and local indexing via tools like notmuch or offlineimap. Keeping system locales and Mutt directives aligned ensures accurate message display across all incoming and outgoing mail.

Written by

Hannah Brooks

Higher Education & Career Writer