VIM: Change encoding of files with VIM VIM Once the file is open with VIM and assuming that the file is encoded with iso-8859-1 (latin1) must be entered in command mode the next line.
If the file is encoded in utf-8 and want to go to iso-8859-1 you must write the next line.
This command will only allow you to change the encoding of the file is open, however it may be necessary to edit the encoding of multiple files to which you can run the following command linux console.
- find-name '*. php'-exec vim {} '+ set fence = utf-8' '+ x' \\;
find-name '*. php' allows you to find one or more files into the directory and the directories contained within it that match the search parameter.
-exec allows to execute a command on files that are found. {}
vim '+ set fence = utf-8' to change the encoding of the files that match your search.