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

Re: Several Mutt usage question



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On Monday, July 13 at 11:30 AM, quoth Paul Grinberg:
>2) I have following in my .muttrc
>
>set charset=koi8-r

This is pretty standard advice on this mailing list by now, but it's 
always worth repeating:

     Do not set $charset yourself.

It is (almost) always the wrong thing to do. The mutt manual includes 
a note that says $charset "should only be set in case Mutt isn't abled 
[sic] to determine the character set used correctly." That isn't 
sufficiently emphatic. Mutt is virtually always able to determine the 
correct character set based on your system environment (i.e. LANG 
and/or LC_CTYPE). If mutt derives an incorrect value from those 
variables (i.e. if those variables are set up incorrectly), then LOTS  
of things are probably broken in your setup. Mutt uses lots of 
system-based string functions (such as isspace()) that do not read 
mutt's config file and rely on those environment variables to define 
the correct character set. In other words, if the environment 
variables are wrong such that mutt can't figure out the right $charset 
setting, then most of the things that mutt relies upon are probably 
not working right either.

>> 2) How do I read an e-mails that are in Hebrew or Russian?
>>
>> It usually displays something like this...
>> \343\305\314\325\300

The answer here is somewhat long (because it depends on your system), 
so the short answer is to read http://wiki.mutt.org/?MuttFaq/Charset 
to understand what's going on.

The logic here is that if mutt displays a character in \123 form, that 
means that mutt has no idea what that character is. If mutt knows what 
the character is but thinks that the character cannot be properly 
displayed, it will replace the character with a question mark. So, the 
fact that it shows up as \343 (or some other number) means, 
essentially, that mutt doesn't know whether that character is 
printable or not, which boils down to: you have messed up your 
$charset setting. Let mutt detect that setting automatically, and it 
will probably get the correct value all by itself. If mutt gets the 
wrong value (or if mutt is still unable to display Hebrew and Russian 
emails), then your environment variables (which mutt and most of the 
rest of your system rely on) are probably incorrect.

To start with, you probably want to make sure that you don't have any 
LC_* variables set (e.g. LC_CTYPE). The primary way to fuss with this 
stuff is to use the LANG environment variable. My guess is that the 
setting in /etc/sysconfig/i18n is correct unless you don't want things 
to be in English.

To find out what values your system supports for the LANG variable, 
run this command:

     locale -a

That will print out a whole bunch, but the value you have 
("en_US.UTF-8") ought to be in that list. Note that capitalization and 
hyphenation MATTERS, so utf8 is not the same as UTF-8 or utf-8 (yes, I 
know that seems pretty stupid).

To prove to yourself that your locales (in other words, the LANG 
variable) are set up correctly, use the perl trick:

     perl -e ""

If your locales are set up correctly, that should do nothing and print 
nothing, but if they're wrong it should complain loudly. To prove that 
it would normally complain, try this:

     env LANG=doesnotexist perl -e ""

Often times, just getting this right (and removing the "set 
charset=..." nonsense from your muttrc) is enough to magically fix 
your mutt display problems. If it doesn't, then something else is set 
up improperly, and we'll be able to figure it out based on what the 
symptoms are at that point.

~Kyle
- -- 
Of course it's the same old story. Truth usually is the same old 
story.
                                                   -- Margaret Thatcher
-----BEGIN PGP SIGNATURE-----
Comment: Thank you for using encryption!

iQIcBAEBCAAGBQJKW2CxAAoJECuveozR/AWeKGcP/28HkffsoEabQ8RnlKpbl1d0
X0cVXdBvRQB7J6lHLlb5yn53AcBdyPieqFhUx6OHikbWaVNiM2dMZ8gLb2s2L1Km
56w3MR/9L2Qqb4qiDyZt4/7mY3KQAN8cdE+NbUcnt0o5pL4vvvJ1uh4kjjlQ1X15
gfibveTOYnUDB6dI2ZpAlvLo+IKi0NpEZd3EF5GOjUcyamnAurnupbB/nOTD6ysw
oSj237fbWFKHCwFdPmIJvuVhJ4EjtnGaOLhfK7XUJF3E63EHyuYpuXrXRC9IeOUu
BMn2c22jX8Hc1XKnZ8qJzwiM/WekidZSUXhugZlOrpnOvW0qhKHB1wtXSAGs0ZJK
GkicZ+vshqOmuCxlb6lvdWX+8y3zKdRv2913yqYRg9kDq4UP8xhOX1eLsYV6w9Am
KDGkyVpsziEoXP86TrsDKkLSKWUAIjZpUZzE7zoZi0/jChdwCT1ZM0deIxhHzt26
IDe/W8yqcGb5VJKB56t2A/TUyhO2Esqlu2fR/bjUT3CuPdo3Ft96MzQnsulEwll3
20OYoolvBucYWGx97dZIx5c/R05pFI5UZp8CXlx2LbDwXFYm8q5ZGkhGM9fjTYga
2lTDXrH4f1jIRSQdVKIxsPti9uCkUqDmZurSeJNQn7F9kL59IRRWXuj8WAFKsGuX
M+KEUuJNJvWRtyPqpbRS
=ai1H
-----END PGP SIGNATURE-----