Skip site navigation (1) Skip section navigation (2)

Re: Support UTF-8 files with BOM in COPY FROM

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Tatsuo Ishii <ishii(at)postgresql(dot)org>, david(at)kineticode(dot)com, itagaki(dot)takahiro(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Support UTF-8 files with BOM in COPY FROM
Date: 2011-09-26 18:47:06
Message-ID: 4E80C8AA.8060307@dunslane.net (view raw or flat)
Thread:
Lists: pgsql-hackers

On 09/26/2011 02:38 PM, Peter Eisentraut wrote:
> On mån, 2011-09-26 at 13:19 -0400, Robert Haas wrote:
>> 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".
>>
>> If a BOM is confusable with valid data, then I think recognizing it
>> and discarding it unconditionally is no good - you could end up where
>> COPY OUT, TRUNCATE, COPY IN changes the table contents.
> We did recently accept a patch for psql -f to skip over a UTF-8
> byte-order mark.  We had a lot of this same discussion there.
>
>

Yes, but wasn't part of the rationale that this was safe because a 
leading BOM could not possibly be mistaken for anything else legitimate 
in an SQL source file? That's quite different from a data file. ISTM.

cheers

andrew

In response to

pgsql-hackers by date

Next:From: Peter EisentrautDate: 2011-09-26 18:49:16
Subject: Re: Support UTF-8 files with BOM in COPY FROM
Previous:From: Robert HaasDate: 2011-09-26 18:44:12
Subject: Re: Support UTF-8 files with BOM in COPY FROM

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group