[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

application/x-gettext mime type and PO files


some email clients use per default a mime type of application/x-gettext for
attached PO files.

I had in the past trouble reading these attachments in mutt inline and was
forced to either change the mime type to text/plain or to save the file
first. This problem may exist in other clients as well.

Now I found a setting which seems to work for me to display PO files inline
and I want to share it with you:

Just add to ~/.mailcap:

# this changes the line "charset=" to the current locale setting but apart
# from this it displays the PO file in the proper encoding!

application/x-gettext; msgcat --to-code=$(eval `locale` && echo $LC_CTYPE |
cut -d. -f2-) %s; needsterminal; copiousoutput;

(all in one line).

Also possible would be

application/x-gettext; iconv -c -f %{charset} %s; needsterminal; copiousoutput;

but some mail clients don't set the encoding of the attachment in the mime
type which results in missing/skipped 8 bit characters.

I failed to use iconv and to extract the encoding from the PO file itself
without writing an external script. Inline code I tested (already simplified):

application/x-gettext; iconv -f iso-8859-1 %s; needsterminal;
copiousoutput; test=grep --quiet -i 'Content-Type:.*charset=.*iso-8859' %s


Reply to: