From: Tom Lane <tgl@sss.pgh.pa.us>
To: Rick Parrish <ai5jt@unitrunker.net>
Cc: bugs <pgsql-bugs@lists.postgresql.org>
Subject: Re: psql include text file with bom
Date: Mon, 27 Nov 2023 09:49:29 -0500
Message-ID: <3852219.1701096569@sss.pgh.pa.us> (raw)
In-Reply-To: <81ca2b25-6b3a-499a-9a09-2dd21253c2cb@unitrunker.net>
References: <81ca2b25-6b3a-499a-9a09-2dd21253c2cb@unitrunker.net>
Rick Parrish <ai5jt@unitrunker.net> writes:
> I think it would be reasonable for the include command to skip over any
> BOM found in the first two or three bytes of a file.
This has been proposed before, and rejected before. psql has no
inherent knowledge of what encoding an input file is in, and therefore
no justification to assume that a bit-pattern it sees there is a BOM.
In non-UTF8 encodings it could very easily be valid data.
(For that matter, it's also valid data in UTF8: it's the same bit
pattern as U+FEFF ZERO WIDTH NO-BREAK SPACE. Programs that emit
one into UTF8 streams, and expect it not to be taken as data,
are frankly broken.)
regards, tom lane
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 using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, ai5jt@unitrunker.net, pgsql-bugs@lists.postgresql.org
Subject: Re: psql include text file with bom
In-Reply-To: <3852219.1701096569@sss.pgh.pa.us>
* 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