The help text for
fileencodings says this:
This is a list of character encodings considered when starting to edit an existing file. When a file is read, Vim tries to use the first mentioned character encoding. If an error is detected, the next one in the list is tried. When an encoding is found that works, 'fileencoding' is set to it.
Since all byte strings are valid
latin1 text, but
utf-8 is more common, I have set my
However, vim appears to use
utf-8 even when there are decoding errors. A minimal example is the file containing the bytes
% xxd test.in
00000000: 00fd ..
% vim test.in
"test.in" [noeol][ILLEGAL BYTE in line 1] 1L, 2C
Why is this? How can I ask vim to fall back to latin1 when it sees illegal bytes?