I have an application that writes ANSI-encoded CSV files to a file share, but the application I use to read them expects UTF-8.
Neither application has the option of changing the encoding, so I have been doing this manually. I have been trying to find a script online that I can use as a scheduled task to convert these files.
Is this even possible? If so can anyone suggest a script.
Right now I have only tried converting manually as I am not sure how to script this.
If you can use Python, the following should get you on the right track.
Presuming that ANSI means Windows-1252, I believe the following script will only change the encoding and leave the "data" as-is.
If the input encoding is something other than Windows-1252 (e.g., 'cp437', 'windows-1254'), just replace the input encoding below:
I made up this input.csv and saved it as Windows-1252:
ran that script, and output.csv looks correct.