I need a Unix command to convert a .csv file that is in UNICODE format to ANSI format.

The file is imported from the Cognos environment and I am unable to make any changes with the format in cognos.

2 Answers 2


You can use iconv to convert between encodings

iconv -f utf-8 -t ascii oldfile > newfile
  • I noticed mine having similar issue but was not able to find what type of encoding it was.

  • Notepad++ tells in my case that it was ANSI so the above command dint help me.

  • Now there are many types of ANSI so the best way to check that was to type

    iconv -l

  • This lists all the encoding format names. So in my case I narrowed that to:

    *iconv -l|grep -i ansi
  • Since I dint know the specific ANSI I tried almost all of them until I found it was MS-ANSI - I should have known, since I received the file from a Microsoft system. So then I converted using this command:

    iconv -f MS-ANSI -t utf-8 sample.csv > sampleUTF8.csv

  • So in the same way list out the UNICODE types in iconv -l and reverse the order to get the ANSI type you desire and would be simple.

  • How does this apply to the question?
    – RalfFriedl
    Dec 13, 2018 at 21:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .