L
o
a
d
i
n
g
.
.
.
https://michele.zonca.org

forcing text files to UTF-8 charset

By Michele Zonca

11 October 2011

first of all I use file utility to get the file charset, with -b and -i parameters to have a brief report, in mime type style:

` michele@erakis:~$ file -bi file.txt text/html; charset=unknown-8bit michele@erakis:~$ vi file.txt`

then in vi

` :set encoding=utf-8 :set fileencoding=utf-8 :wq `

let’s check

` michele@erakis:~$ file -bi file.txt text/html; charset=utf-8 `