Hi Tony :)

 * A.J.Mechelynck <[EMAIL PROTECTED]> dixit:
> DervishD wrote:
> [...]
> >    So, and if I understand everything correctly, if my locale is
> >latin1, my terminal is latin1 (that is, enc=latin1 and tenc=latin1) and
> >I want to edit/view utf8 files *and* I don't want new files or US-ASCII
> >files to be considered utf8, my best bet is to use "BufReadPre" to
> >detect utf8 files using "file -i" or something similar, thus forcing the
> >conversion, am I wrong?
> 
> I'm not sure: what happens if your UTF-8 file contains some character (such 
> as the Euro sign) which has no representation in Latin1?

    I don't know what Vim does in that case, but no matter if I use
"BufReadPre", "fencs=ucs-bom,utf8,latin1" or my current method, there
won't be any difference.

    In fact, I'm not worried by non-representable characters - I know
that my console is latin1 and it's text mode, I know the limitations -
but with representable characters. I mean, by setting 'fencs' to the
'ucs-bom,utf8,latin1' string I can see utf8 files containing
latin1-representable characters correctly, because Vim does the
conversion, but then my US-ASCII and any new file will be saved with
utf8 encoding, and I need to avoid that, so I manually set "fenc" at
runtime. BUT then no conversion is done.

    My error was assuming that setting "fenc" will do any needed
conversion just as if the file was freshly read. I could use ":e!
++enc=utf8", of course, but then I'll lose any unsaved change. And of
course, I could do a mapping that does the ":e" and a previous
":setlocal fenc=utf8" plus ":w", but I was looking for a simpler
solution (if any).

    Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736 | http://www.dervishd.net
It's my PC and I'll cry if I want to... RAmen!

Reply via email to