On Wed, Dec 9, 2020 at 9:20 PM Gabriele F <g...@tiscali.it> wrote: > > On 09/12/2020 18.47, A. Wik wrote: > > I don't include utf8 in my default fencs setting because that has the > > side effect of using utf8 for any newly created files. > > Completely off-topic, if you don't have particular needs I'd advise you > to use UTF- 8 with BOMs for all your new files ('set bomb', 'set > encoding=utf-8' and 'fenc' left to the default in your vimrc), it will > prevent any future encoding problem for at least them. > > I've been doing so for more than a decade and pretty much never had > problems, and sigh a relief every time I see I'm working with one of them. > > I heard many protest the BOMs in UTF-8, but they are the first thing > ever to allow a reliable encoding detection and they solve a lot more > problems than they can cause (if they cause problems they usually do so > immediately and noticeably, much better than discovering years later > that you irremediably botched the encoding of some file). So I find it > absurd to disparage them, and delusive to think that we'll ever get to a > point when non-utf8 files will be rare enough that we won't need to > handle them. > I imagine most of the critics are from countries that never needed more > than ASCII
IIUC the critics are from people who do a lot of programming, either in C (where sources are supposed to be in Latin1; they may be in UTF-8 if characters above U+007F are used only in alphanumeric literals, but they cannot start with a BOM) or in Perl, Python, Unix shell script language, etc. (where the first two bytes of a source file must be #! in that order): The problem with ":setg fenc=utf8 bomb" is that *every* new text file will start with 0xEF 0xBB 0xBF unless you explicitly turn it off for that file by means of ":setl nobomb" or ":setl fenc=latin1" or similar before writing it. For C sources this wil confuse the compiler (generating an error and preventing successful compilation) and for anything starting with a shebang (shell scripts, perl sources, etc.) it will prevent the #! shebang leader from being recognized. OTOH for "well-behaved" filetypes like Vim scripts (if not run by means of a shebang), HTML pages, CSS style sheets, etc., there is no problem. So whether or not to set it should depend on what types of files you write most often. I use it because most of the files I write are HTML or CSS, followed by Vim scripts; but then when I write a shell script I have to remember to turn the 'bomb' setting off for that file. Best regards, Tony. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXtbAtoj%2BU0EfF-oudbmoMng5nt2AbZZUi%2B7N6HayrwqmA%40mail.gmail.com.