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

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

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Support UTF-8 files with BOM in COPY FROM
Date: 2011-09-26 11:12:42
Message-ID: CABUevExwxVivjbyxdv4=R_JQP=POs=BoMgzsrL1OJ3CTMjaVDw@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On Mon, Sep 26, 2011 at 06:58, Itagaki Takahiro
<itagaki(dot)takahiro(at)gmail(dot)com> wrote:
> Hi,
>
> I'd like to support UTF-8 text or csv files that has BOM (byte order mark)
> in COPY FROM command. BOM will be automatically detected and ignored
> if the file encoding is UTF-8. WIP patch attached.
>
> I'm thinking about only COPY FROM for reads, but if someone wants to add
> BOM in COPY TO, we might also support COPY TO WITH BOM for writes.
>
> Comments welcome.

I like it in general. But if we're looking at the BOM, shouldn't we
also look and *reject* the file if it's a BOM for a non-UTF8 file? Say
if the BOM claims it's UTF16?

-- 
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

In response to

Responses

pgsql-hackers by date

Next:From: Itagaki TakahiroDate: 2011-09-26 11:36:11
Subject: Re: Support UTF-8 files with BOM in COPY FROM
Previous:From: Peter EisentrautDate: 2011-09-26 10:55:12
Subject: Re: Is there any plan to add unsigned integer types?

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