Re: Support UTF-8 files with BOM in COPY FROM - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Support UTF-8 files with BOM in COPY FROM
Date
Msg-id 10446.1317059547@sss.pgh.pa.us
Whole thread Raw
In response to Re: Support UTF-8 files with BOM in COPY FROM  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Mon, Sep 26, 2011 at 1:28 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Robert Haas <robertmhaas@gmail.com> writes:
>>> The thing that makes me doubt that is this comment from Tatsuo Ishii:
>>> TI> COPY explicitly specifies the encoding (to be UTF-8 in this case). �So
>>> TI> I think we should not regard U+FEFF as "BOM" in COPY, rather we should
>>> TI> regard U+FEFF as "ZERO WIDTH NO-BREAK SPACE".

>> Yeah, that's a reasonable argument for rejecting the patch altogether.

> Yeah, or for making the behavior optional.

Sorry, I should have been clearer: it's an argument for rejecting *this*
patch.  A patch that introduced a "BOM" option for COPY (which logically
could apply just as well to input or output) would be a different patch.

BTW, another issue with the patch-as-proposed is that it assumes,
without even checking, that fseek() will work (for that matter, it would
also fail pretty miserably on a file shorter than 3 bytes).  We could
dodge that problem with an option since it would be reasonable to define
the option as meaning that there MUST be a BOM there.  I would envision
it as acting much like the CSV HEADER option.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Support UTF-8 files with BOM in COPY FROM
Next
From: Peter Eisentraut
Date:
Subject: Re: Support UTF-8 files with BOM in COPY FROM