El día Wednesday, October 06, 2010 a las 09:17:48AM -0500, Kyle Wheeler 
escribió:

> 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 ¡.
...

It is converted *before* it is stored into the temp file for 'vim'; I've
checked this with truss(1) what mutt hands over to vim (see the
^^^^marked bytes):

write(5,"El d\M-ma Wednesday, October 06, 2010 a las 03:18:39PM +0200,
Matthias Apitz escribi\M-s:\n\n> \n> \M-C\M-!\n> \n> -- \n> Matthias
                             ^^^^^^^^^^^^^^^^^^^
Apitz\n> t +49-89-61308 351 - f +49-89-61308 399 - m +49-170-4527211\n>
e <g...@unixarea.de> - w http://www.unixarea.de/\n\n-- \nMatthias
Apitz\nt +49-89-61308 351 - f +49-89-61308 399 - m +49-170-4527211\ne
<g...@unixarea.de> - w http://www.unixarea.de/\n",361) = 361 (0x169)
close(5)                                         = 0 (0x0)

Thanks for your comment any way. Btw: LANG is set to

g...@current:~> env | egrep 'LANG|LC_'
LANG=es_ES.UTF-8

        matthias

-- 
Matthias Apitz
t +49-89-61308 351 - f +49-89-61308 399 - m +49-170-4527211
e <g...@unixarea.de> - w http://www.unixarea.de/

Reply via email to