Re: Maintaining accents with "COPY" ?

Поиск
Список
Период
Сортировка
Искать
От
Peter J. Holzer
Тема
Re: Maintaining accents with "COPY" ?
Дата
в 11:26:51
Msg-id
20230525112651.hehzirqm2qzpfxkr@hjp.at
Ответ на
Список
Дерево обсуждения
Maintaining accents with "COPY" ? Laura Smith <n5d9xq3ti233xiyif2vp@protonmail.ch>
Re: Maintaining accents with "COPY" ? Erik Wienhold <ewie@ewie.name>
Re: Maintaining accents with "COPY" ? Laura Smith <n5d9xq3ti233xiyif2vp@protonmail.ch>
Re: Maintaining accents with "COPY" ? Erik Wienhold <ewie@ewie.name>
Re: Maintaining accents with "COPY" ? "Peter J. Holzer" <hjp-pgsql@hjp.at>
Re: Maintaining accents with "COPY" ? Erik Wienhold <ewie@ewie.name>
On 2023-05-25 07:14:40 +0000, Laura Smith wrote:
> I'm currently doing a CSV export using COPY:
> 
> COPY (select * from foo where bar='foo') TO '/tmp/bar.csv' DELIMITER ',' CSV HEADER;
> 
> 
> This works great apart from accents are not preserved in the output,
> for example é gets converted to random characters, e.g. √© or similar.

How do you check the output?

If a single character is turned into 2 or 3 characters the issue is
usually that the program which produces the output (in the case of COPY
I think that would be the PostgreSQL server, not the client) produces
UTF-8, but the program consuming it expects an 8-bit character set
(typically windows-1252). See if oyu can tell that program that the file
is in UTF-8.

> How can I preserve accents ?

They probably already are preserved.

        hp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"
В списке pgsql-general по дате отправления
От: Laura Smith
Дата:
От: Sengottaiyan T
Дата:
FAQ