Re: Maintaining accents with "COPY" ?

From: Laura Smith <n5d9xq3ti233xiyif2vp(at)protonmail(dot)ch>
To: Erik Wienhold <ewie(at)ewie(dot)name>
Cc: postgre <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Maintaining accents with "COPY" ?
Date: 2023-05-25 10:08:58
Message-ID: EJ3xpih1m0uA4lqe2jtP2HiDg7PtoTSN8hHylWgbTOWODAAfVFOi_YnbWxSEmdtZmyIJypeni3LpwxZtGmsbZkx-o_TamG6aDOj0JRd6qtI=@protonmail.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> Looks like an encoding issue and a mismatch between database encoding and client
> encoding. You can check both with:
>
> SHOW server_encoding;
> SHOW client_encoding;
>
> Then either set the client encoding or use COPY's encoding option to match the
> database encoding (I assume utf8 in this example):
>
> SET client_encoding = 'utf8';
> COPY (...) TO /tmp/bar.csv DELIMITER ',' CSV HEADER ENCODING 'utf8';
>
> --
> Erik

Hi Erik,

Looks like you could well be right about encoding:

postgres=# SHOW server_encoding;
server_encoding
-----------------
UTF8
(1 row)

postgres=# SHOW client_encoding;
client_encoding
-----------------
SQL_ASCII
(1 row)

I will try your suggestion...

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter J. Holzer 2023-05-25 11:26:51 Re: Maintaining accents with "COPY" ?
Previous Message Erik Wienhold 2023-05-25 07:48:26 Re: Maintaining accents with "COPY" ?