Search code examples
postgresqlcsvansi

How to use postgresql copy command with ANSI encoding?


I use PostgreSQL copy command to make a csv file.

COPY (select * from table) from '/tmp/123456.csv' with csv header encoding 'UTF8';

this command is ok

But I want to make file with ANSI encoding, because I want to open it in Microsoft Excel

COPY (select * from table) from '/tmp/123456.csv' with csv header encoding 'ANSI';

this command can't make csv file


Solution

  • Since you seem to be on Windows, maybe you want to use one of the Windows encodings, for example WIN1252 for western European languages.