Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just wanted to convert a txt file to UTF-8, since cat displays it correctly, but vi or gedit doesn't:

$ cat test.txt 
$ iconv -f WINDOWS-1253 -t UTF-8 test.txt 
β”iconv: illegal input sequence at position 18

Q: how can I convert my txt to UTF-8? iconv doesn't works.

share|improve this question
Could you show us the output of file test.txt? Are you sure it's not already utf8? – terdon Apr 22 '14 at 11:36

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.

share|improve this answer

The source characters look like it may be ATARI. Try -f ATARI or -f ATARIST

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.