I\'m using :set fileencoding=utf-8 and the file is saved correctly, but the next time I open it, I get garbled characters and :set fileencoding? sa
You should set fileencodings to the different encodings vim should try when opening a file, for example:
set fileencodings=ucs-bom,utf-8,latin1
From :help fileencodings:
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,
fileencodingis set to it.
You best put these settings in your .vimrc file so that you don't have to input them manually each time you start vim.