Python 3 — Convert ANSI to UTF-8 on Windows

After trying several different methods, the only one I found to work was iconv. See a list of possible encodings here.

In my case, I was trying to convert an ANSI-encoded CSV created in a legacy Windows application to UTF-8 to be imported into Postgres. Even with the conversion, Postgres complained about null characters. If you need to remove any invalid characters, use the tr utility.