Glenn Maynard wrote:
> Well, is this exact? > > My default fenc is "cp1252" (as I'm using the test setting I mentioned). > > If I load a UTF-8 file, fenc becomes UTF-8. > > But, if I then :new, the new window is created with fenc=cp1252, despite > fenc being UTF-8. > > Doing a :set fenc in each window then shows that it's different for > each, but :new always creates fenc=cp1252. > > This makes me conclude that there's a "global" fenc, which determines > the default encoding of new files, and a "local" fenc to each window, > marking the encoding of that file. > > That's fine, except it seems undocumented, and it's not clear how to > explicitely set the "global" fenc versus the current "local" one. It's all documented, but it's a bit complicated. This is required to make it work in all situations. You did read the docs for 'fileencodings'? It explains what happens when opening a file. For a new file the explanation is at ":help local-options". Obviously 'fenc' is a buffer-local option. The info about local options isn't repeated for every option, you need to read the introduction. > > You probably want to set 'fileencodings' to "utf-8" or make it empty. > > Then Vim won't check for a BOM or fall back to using latin1. You still > > get CONVERSION ERRORs when editing a file with an illegal byte sequence, > > and that's a good hint for the user. > > It'll also set the file readonly, though, which probably isn't wanted > here. For a real conversion error this is appropriate. An error while reading a file always makes it marked as read-only to prevent you from accidentally overwriting the original file with an errornous version. But in this specific case the file can be written unmodified, thus it doesn't need to be marked read-only. I'll see if this situation can be detected reliably. -- Emacs is a nice OS - but it lacks a good text editor. That's why I am using Vim. --Anonymous /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.moolenaar.net \\\ /// Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim \\\ \\\ Project leader for A-A-P -- http://www.a-a-p.org /// \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html /// -- Linux-UTF8: i18n of Linux on all levels Archive: http://mail.nl.linux.org/linux-utf8/
