From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: Matthias Apitz <guru@unixarea.de>
Cc: Thomas Munro <thomas.munro@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: \COPY to accept non UTF-8 chars in CHAR columns
Date: Sat, 28 Mar 2020 14:08:47 +0000
Message-ID: <87bloga8ce.fsf@news-spur.riddles.org.uk> (raw)
In-Reply-To: <20200328094011.GA2961@c720-r342378>
References: <20200327153623.GA32266@sh4-5.1blu.de>
<8922.1585323994@sss.pgh.pa.us>
<CA+hUKG+BAtBCXaB-0SYxNiVV3_CAbHvm7sm1PJWyhJFvTi_R3A@mail.gmail.com>
<20200328094011.GA2961@c720-r342378>
>>>>> "Matthias" == Matthias Apitz <guru@unixarea.de> writes:
Matthias> i.e. 0xc3 is translated to 0xc383 and the 2nd half, the
Matthias> 0xbc to 0xc2bc, both translations have nothing to do with
Matthias> the original split 0xc3bc, and perhaps in this case it
Matthias> would be better to spill out a blank 0x40 for each of the
Matthias> bytes which formed the 0xc3bc.
If the only malformed sequences are there as a result of splitting up
valid sequences, then you could do something like convert all invalid
sequences to (sequences of) noncharacters, then once the data is
imported, fix it up by adjusting how the data is split and regenerating
the correct sequence (assuming your application allows this).
For example you could encode an arbitrary byte xy as a sequence of two
codepoints U+FDDx U+FDEy (the range FDD0-FDEF are all defined as
noncharacters).
--
Andrew (irc:RhodiumToad)
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: andrew@tao11.riddles.org.uk, guru@unixarea.de, thomas.munro@gmail.com, tgl@sss.pgh.pa.us
Subject: Re: \COPY to accept non UTF-8 chars in CHAR columns
In-Reply-To: <87bloga8ce.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> <20200328094011.GA2961@c720-r342378> <87bloga8ce.fsf@news-spur.riddles.org.uk>
* 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