Let's say I have a text file with content


and in vi/vim I have set fileencoding as :set fileencoding=ISO-8859-9.

Later when I check the encoding with

file -i <myFile>

it gives text/plain; charset=ISO-8859-1 although it should have been ISO-8859-9.

Why is that? How can I make file -i return ISO-8859-9?

Because otherwise when I reopen the file in vi/vim it assumes encoding ISO-8859-1 and shows wrong characters:

  • You need to look at the 'fileencodings' option, too. Set your preferred before others. – Heptite Jan 25 '17 at 21:51
  • @Heptite it only helps to set correct encoding for vim. it doesn't solve my original question which is How can I make file -i return ISO-8859-9 – destan Jan 26 '17 at 7:44
  • 1
    I've tried to look into it, but from what I can see it's unlikely the file utility can (reliably) distinguish between the ISO-8859-* encodings. Do you have the option of going UTF8 instead? – Heptite Jan 28 '17 at 0:13
  • @Heptite if only I could use utf8 but there is a database on which I don't have any authority and it only accepts iso-8859-9 – destan Jan 28 '17 at 0:27

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.