-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
On Wednesday, October 6 at 03:48 PM, quoth Matthias Apitz:
> It seems I have opened now the "Pandora's box" :-)
Indeed! But at some point, it'll Just Work (tm).
> What combination of terminal and editor should be used now? When I'm
> receiving an ISO-8859-1 message with, for example, the Spanish char
> á (0xe1 in ISO) and I do a reply then:
>
> with xterm (ISO-8859-1) and 'vim' the á is correctly presented as
>
> > á
>
>with urxvt (UTF-8) and 'vim' the á is presented as
>
> > á
>
>Why is this?
It's because vim isn't *told* what character set the input file will
be; it has to guess. Mutt is handing it a UTF-8 file (because mutt
converts mail messages into whatever the local terminal character set
is before handing it to any other program (such as vim), for obvious
reasons). In UTF-8, the á character is represented as a two-byte
character: 0xc3 0xa1. However, your vim is assuming that input files
are in ISO-8859-1, and both of those bytes are valid ISO-8859-1
characters (this is the fundamentally impossible problem of
determining character set from unidentified byte streams). As you
might imagine, 0xc3 is Â, and 0xa1 is ¡.
This is what I have in my vimrc to handle this:
if has("multi_byte")
set encoding=utf-8
if $LANG !~ '\(UTF\|utf\)-\?8' && $LC_CTYPE !~ '\(UTF\|utf\)-\?8'
" Note that this only works if your shell GUARANTEES that
" either LANG or LC_CTYPE will be set correctly (as mine
" does). If not, it would be useful to do more thorough
" terminal detection here... but you really should make
" sure that LANG and/or LC_CTYPE is set correctly.
set termencoding=latin1
endif
endif
~Kyle
- --
Morality, like art, means drawing a line someplace.
-- Oscar Wilde
-----BEGIN PGP SIGNATURE-----
Comment: Thank you for using encryption!
iQIcBAEBCAAGBQJMrIUBAAoJECuveozR/AWeoZoQAIciEQffoLoECthEB2h7lVGg
Lk9+siJSSZeTQO47hQglUw+wMGdgBRqisH1mEAiztJcObwaD5zXVgbvEHvRxsMPW
og8x0+h2yL+Tz5PxAwBtfqCwB2sWdddkX/mfcfs45l4yfP2jW60oK1W0t5N1e4fO
TXCCGAckPy1pTygPuUKVU8dhJR577J/Hki7RBneihY3T0PfKzkLhyOGsEEVZCKkR
9DV6Uvdlu45yLVhomUr/puhruUpi/vKfxr4BwzXsZ9aEPw98zkthDn8fATmdXH2A
+otONaMQglnd+K61ic3DrulpBTOB0QDwSvvVJrv38NKgz7tGxngQppvR6TOcnoSD
Qn7dahWTpP4s0IxrMbmEhMNr3MNf+Jg5dWMIfKOxAERRgRRYQ2ixQIbFIpcPaH4C
fw0drbshOdXDMbZrkLkTO6Vf7sNkMxaVo+f1HAZ/TWsfcZz9pWhPmAqeVv6Azxk7
N/2/kJWU7+k8K6DbnMcfL8P3sBfTaarfkuWPzQoU69Mny+NSAtFU30DeNkAqieNp
4uqSwh/U54HtvMtQ0dtHgpRFGIEw1xLQBUGznTBfpcy5wYOUnXQBqlswQjkoOl9v
pJ9OGL2+1qEJRTJQc1NS8rNlkM0AqV/qu3WnpOZOkjora8dNELkSQtaAbEWsDn3r
lAnbR1IyjwSGvqlHJLfx
=skjq
-----END PGP SIGNATURE-----