Your file contains characters such as ├
and └
which are not in Windows-1253, so whether the iconv
fails or not, you did not specify the correct input encoding and therefore the output is wrong.
If cat
displays the file correctly, then the file's encoding is the same as your terminal's. Run the command locale
and look at the LC_CTYPE
line to see what encoding your terminal is using. It's likely that the file is, in fact, already encoded in UTF-8.
It seems that Vi and Gedit are failing to detect the encoding of the file automatically. Have you configured them to assume a particular encoding? If so, don't do that. If not, in Gedit, select “UTF-8” instead of “automatically detected” when opening the file. In Vim, use :set encoding=utf-8
.
file test.txt
? Are you sure it's not already utf8? – terdon Apr 22 '14 at 11:36