Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  FIX-MIME-CHARSET (1)

.ds Aq ’


fix-mime-charset - fix incorrect charset specifications in MIME messages



fix-mime-charset [-BfLm?V] [-c charset] [-I charset,...] [-l language] [-O charset,...] [--break-signature] [--charset=charset] [--force-override] [--ignore-charsets=charset,...] [--lang=language] [--mailbox] [--only-charsets=charset,...] [--show-langs] [--help] [--usage] [--version] [file...]


In non-English mailing lists (particularly in Russian) there is a big problem with messages, where charset parameter of Content-Type header is set incorrectly. Sometimes software is buggy, sometimes people cannot set up their software properly, sometimes web-based email clients do not implement charsets. While reading such a mail, one should manually switch encoding in MUA back and forth. Incorrectly encoded or plain 8-bit Subject field is another big problem. Such fields often get corrupted while passing e-mail gateways.

This program can be used to solve these problems while used as mail filter (in MTA, procmail(1) or similar program). It tries to detect correct charset automatically (currently only Russian language KOI8-R, Windows-1251 and UTF-8 charsets are detected) and fixes Content-Type and Subject headers of the message or message subpart. fix-mime-charset interprets multipart messages correctly and processes text/plain subparts only. Attachments, other headers and body of the message are not touched. fix-mime-charset correctly interprets quoted-printable and base64 transfer-encodings. Program is written to be very fast and use minimal amount of memory.

When no files are given in command line, the program reads input from stdin. When several files are given, they are concatenated in the order of appearance.


-B, --break-signature Enable fixing charset information in multipart/signed messages. Modication of Content-Type field in this case will result in broken signature. You may enable this option if you prefer readable text to verifyable signatures. In any case fix-mime-charset will not modify the message if everything is correct.

By default, multipart/signed messages are leaved untouched.

-c, --charset=charset Charset to be used when it cannot be determined automatically. By default, in this case Content-Type field is leaved untouched. If Content-Type field is absent, charset given in this option is used (us-ascii by default). This behavior may be overriden by -f switch.
-f, --force-override Always override charset of Content-Type field. By default, Content-Type field is leaved untouched if charset cannot be determined automatically. When this option is used, charset given by -c option overrides Content-Type field.
-I, --ignore-charsets=charset,... Ignore messages with given charsets. us-ascii charset is assumed when charset is not set in Content-Type field. Charsets in list may be separated by space, comma, colon or semicolon. This option can be repeated several times and lists are joined in this case.
-l, --lang=language Set language for autodetection. language is two-letter ISO 639:1989 language code. fix-mime-charset -L gives list of all available languages and language codes.

Default language is ru (Russian).

-L, --show-langs Gives list of all available languages and language codes.
-m, --mailbox Process input as Unix mailbox (From lines are used as message delimiters). Without this option, input is considered to be an individual message and messages should be passed to the filter one-by-one.
-O, --only-charsets=charset,... Process messages with given charsets only. us-ascii charset is assumed when charset is not set in Content-Type field. Charsets in list may be separated by space, comma, colon or semicolon. This option can be repeated several times and lists are joined in this case.
-?, --help Print help message and exit.
--usage Give a short usage message and exit.
-V, --version Print version information and exit.


Some people asked me for examples of using fix-mime-charset with procmail(1). It is very easy - simply insert the following rule into .procmailrc:

  :0 f
  | fix-mime-charset

Filtering rule is non-delivering in terms of procmail(1) and filtered mail will be transferred to following rules.

It is equally easy to filter limited subset of messages:

  * <your filter here>
    :0 f
    | fix-mime-charset

    <delivering rules here>


Dmitry E. Melamud <>


This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.


Search for    or go to Top of page |  Section 1 |  Main Index

v.0.5.3 FIX-MIME-CHARSET (1) 2003-12-13

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.