From: Erik Wienhold <ewie@ewie.name>
To: Laura Smith <n5d9xq3ti233xiyif2vp@protonmail.ch>
Cc: postgre <pgsql-general@lists.postgresql.org>
Subject: Re: Maintaining accents with "COPY" ?
Date: Thu, 25 May 2023 14:37:18 +0200 (CEST)
Message-ID: <564260964.222854.1685018238693@office.mailbox.org> (raw)
In-Reply-To: <EJ3xpih1m0uA4lqe2jtP2HiDg7PtoTSN8hHylWgbTOWODAAfVFOi_YnbWxSEmdtZmyIJypeni3LpwxZtGmsbZkx-o_TamG6aDOj0JRd6qtI=@protonmail.ch>
References: <oecekDAbp5O7kdlV4eD_J2uPWFHDwuf4CO3DFaJHQiT7gbFp1peO0UYyAfkUDEvS1h8bjxrUMf91YPrjUr7Rib-flXJWwHyr2vRIt_S8hcI=@protonmail.ch>
<1917340025.188822.1685000906999@office.mailbox.org>
<EJ3xpih1m0uA4lqe2jtP2HiDg7PtoTSN8hHylWgbTOWODAAfVFOi_YnbWxSEmdtZmyIJypeni3LpwxZtGmsbZkx-o_TamG6aDOj0JRd6qtI=@protonmail.ch>
> On 25/05/2023 12:08 CEST Laura Smith <n5d9xq3ti233xiyif2vp@protonmail.ch> wrote:
>
> > 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';
>
> 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...
The client encoding is not the problem here. Using SQL_ASCII effectively uses
the server encoding. SQL_ASCII basically means uninterpreted bytes/characters.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: ewie@ewie.name, n5d9xq3ti233xiyif2vp@protonmail.ch
Subject: Re: Maintaining accents with "COPY" ?
In-Reply-To: <564260964.222854.1685018238693@office.mailbox.org>
References: <oecekDAbp5O7kdlV4eD_J2uPWFHDwuf4CO3DFaJHQiT7gbFp1peO0UYyAfkUDEvS1h8bjxrUMf91YPrjUr7Rib-flXJWwHyr2vRIt_S8hcI=@protonmail.ch> <1917340025.188822.1685000906999@office.mailbox.org> <EJ3xpih1m0uA4lqe2jtP2HiDg7PtoTSN8hHylWgbTOWODAAfVFOi_YnbWxSEmdtZmyIJypeni3LpwxZtGmsbZkx-o_TamG6aDOj0JRd6qtI=@protonmail.ch> <564260964.222854.1685018238693@office.mailbox.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox