My system locale is set to UTF-8:US, this is confirmed by running the locale command. But it is very strange that every time I type the vim FILENAME command (the file does not exist, I'm using this command to create a new file), and I use :wq to save the file, I always get file coded in ASCII. I tried to add the line set fileencodings=utf-8 in the .vimrc file, but nothing changed. How can I solve this ?
            Asked
            
        
        
            Active
            
        
            Viewed 2,864 times
        
    3
            
            
         
    
    
        No No
        
- 31
2 Answers
3
            
            
        When all your chars are < 128 ASCII and UTF-8 are the same.
ASCII is a subset of UTF-8 (and also a subset of latin1 and many other encoding formats).
Probably everything is perfect!
The configuration command:
set fileencodings=list of encoding formats to try
is used to define the order of encoding format that vim will try to use when opening a file.
set fileencodings=ucs-bom,utf-8,latin1 is a better idea: first try
to use any Unicode with a BOM header, then it will try to interpret it as UTF-8, and if everything fails latin1.
