gvim 8.2.2267 (Big) with GTK3 GUI; 'encoding' = utf-8; 'filencodings' (plural) = ucs-bom,utf-8,latin1
Steps to reproduce: 1. Load a Latin1 file containing only characters in the range 0x00-0x7F. (In my case this was a corrupt version of the file.) -- 'fileencoding' is set to utf-8, which at this point is acceptable, since the de-facto encoding is us-ascii, which is byte-compatible with both Latin1 and UTF-8. 2. Replace the file-on-disk (by non-Vim methods) by a version containing one or more (Latin1) characters in the range 0x80-0xFF. (In my case this was the correct version of the file, after fetching it over the Net.) -- Vim gives a prompt, with options [O]K, [L]oad file 3. Answer l (Load). -- File is reloaded, but the 'fileencodings' heuristic is not reapplied: 'fileencoding' (singular) is still utf-8, any Latin1 characters above 0x7F (which are not valid UTF-8 byte sequences) are changed to question marks. No error for invalid byte sequences (I didn't notice any at the time, and none is recorded in the :mess messages list). 4. Make some more changes inside Vim, adding more characters in the range 0x7F-0xFF, then save. -- File is saved as UTF-8; if read as Latin1 outside of Vim, weird characters appear where changes were made at step 4. <-- bad 5. :setl fenc=latin1 | w -- If reloaded outside of Vim, the weird characters have now disappeared; but the question marks, if not replaced by what they should be, are still there. Best regards, Tony. -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/CAJkCKXuqoaZ6kvN%2Bwyf6474JDYJEGbS-bUb2-wmbqMM2faE_fw%40mail.gmail.com.
