pg.ddx.io pgsql-general@postgresql.org mailing list archivehelp / color / mirror / Atom feed
From: Rory Campbell-Lange <rory@campbell-lange.net>
To: Andrew Gierth <andrew@tao11.riddles.org.uk>
Cc: Thomas Munro <thomas.munro@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Matthias Apitz <guru@unixarea.de>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: \COPY to accept non UTF-8 chars in CHAR columns
Date: Fri, 27 Mar 2020 22:18:35 +0000
Message-ID: <20200327221835.GA27613@campbell-lange.net> (raw)
In-Reply-To: <87k135a2hd.fsf@news-spur.riddles.org.uk>
References: <20200327153623.GA32266@sh4-5.1blu.de>
<8922.1585323994@sss.pgh.pa.us>
<CA+hUKG+BAtBCXaB-0SYxNiVV3_CAbHvm7sm1PJWyhJFvTi_R3A@mail.gmail.com>
<87k135a2hd.fsf@news-spur.riddles.org.uk>
On 27/03/20, Andrew Gierth (andrew@tao11.riddles.org.uk) wrote:
> >>>>> "Thomas" == Thomas Munro <thomas.munro@gmail.com> writes:
>
> Thomas> Something like this approach might be useful for fixing the CSV file:
>
> Thomas> https://codereview.stackexchange.com/questions/185821/convert-a-mix-of-latin-1-and-utf-8-to-proper-u...
>
> Or:
>
> perl -MEncode -pe '
> use bytes;
> sub c { decode("UTF-8",shift,sub { decode("windows-1252", chr(shift)) }); }
> s/([\x80-\xFF]+)/encode("UTF-8",c($1))/eg' <infile >outfile
Or:
iconv -f WINDOWS-1252 -t UTF-8 -c < tempfile2 > tempfile3
view thread (9+ messages) latest in thread
Message-ID: <20200327221835.GA27613@campbell-lange.net> Permalink: ../20200327221835.GA27613@campbell-lange.net/ Also on: postgresql.org/message-id/20200327221835.GA27613@campbell-lange.net ·
reply
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: rory@campbell-lange.net, andrew@tao11.riddles.org.uk, thomas.munro@gmail.com, tgl@sss.pgh.pa.us, guru@unixarea.de Subject: Re: \COPY to accept non UTF-8 chars in CHAR columns In-Reply-To: <20200327221835.GA27613@campbell-lange.net> References: <20200327153623.GA32266@sh4-5.1blu.de> <8922.1585323994@sss.pgh.pa.us> <CA+hUKG+BAtBCXaB-0SYxNiVV3_CAbHvm7sm1PJWyhJFvTi_R3A@mail.gmail.com> <87k135a2hd.fsf@news-spur.riddles.org.uk> <20200327221835.GA27613@campbell-lange.net> * 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