#PostgreSQL Help - Charsets 

I have a little PostgreSQL database running for tinkering with at home. I am importing a text file from CLI using \copy. The text file is UTF8. The database is en_US.UTF8. Yet the import changes Mötley Crüe into Mötley Crüe, Motörhead into Motörhead. I've been staring at this too long now. Help!

Follow

#PostgreSQL Help - Charsets 

@anomis66 documentation at postgresql.org/docs/current/sq but probably you want to specify encoding 'utf8':

\copy (select * from systems) to stdout with (format 'csv', encoding 'utf8');

(Or you could try pg_dump instead.)

· · Web · 1 · 0 · 1

#PostgreSQL Help - Charsets 

@h2g2bob Good shout! I would never have thought to force the encoding on the \copy even when the database collation and csv file are both already in UTF8 charset.
@mikedimmick

Sign in to participate in the conversation
Mastodon

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!