0

I am using an old app cannot handle UTF-8 characters. The csv files are SFTP to a folder with default UTF-8. Is there a way to automatically convert UTF-8 to ANSI? Can this be done in windows setting or I have to put some code to convert them?

Thank you!

F Y
  • 1
  • 1
  • You have to convert them. See [Best way to convert text files between character sets](https://stackoverflow.com/questions/64860/best-way-to-convert-text-files-between-character-sets?rq=1) – Mark Tolonen Jun 09 '22 at 17:58
  • Are you sure your CSV has only character in the cp1252? (please do not use ANSI, it is not ANSI). How do you intend to handle fall backs? Personally I would just open them as UTF-8, and having something which seems garbage for some non ASCII characters, but if app will not mangle them, you get a correct UTF-8 results in the output. – Giacomo Catenazzi Jun 10 '22 at 08:43

1 Answers1

0

Historically, I have used my own custom tools to do this.

But these days, if you have WSL, CygWin or MingW installed, you can use the GNU iconv tool to do the conversion, after first using other tools (such as head -c 3) to check if the input file has the 3 byte UTF-8 encoded BOM character as a file format marker.

jb_dk
  • 117
  • 6