Re: psql include text file with bom - Mailing list pgsql-bugs

From Tom Lane
Subject Re: psql include text file with bom
Date
Msg-id 3852219.1701096569@sss.pgh.pa.us
Whole thread Raw
In response to psql include text file with bom  (Rick Parrish <ai5jt@unitrunker.net>)
List pgsql-bugs
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



pgsql-bugs by date:

Previous
From: vignesh C
Date:
Subject: Re: [16+] subscription can end up in inconsistent state
Next
From: Tom Lane
Date:
Subject: Re: BUG #18187: Unexpected error: "variable not found in subplan target lists" triggered by JOIN