Re: psql blows up on BOM character sequence

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jim Nasby <jim(at)nasby(dot)net>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Merlin Moncure <mmoncure(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql blows up on BOM character sequence
Date: 2014-03-25 03:53:14
Message-ID: 5330FDAA.2060709@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 03/25/2014 07:05 AM, Tom Lane wrote:
> Jim Nasby <jim(at)nasby(dot)net> writes:
>> Wait... I thought that was one of the objections... that we wanted to
>> leave a BOM in something like a COPY untouched?
>
> I think most of us are okay with stripping a BOM that appears at the
> *beginning* of a text file (assuming there's reason to believe the file
> is in UTF8 encoding). BOM sequences embedded later in the file are a lot
> more debatable, and I for one don't want to assume those can be dropped.
> I don't know of any legitimate usage of such cases, and think it's
> probably better to report an encoding error.

Yep, it's absolutely an encoding error IMO.

Something like:

ERROR: Invalid UTF-8 - probable UTF-8 byte-order mark detected
mid-data-stream.
HINT: Multiple files with byte-order marks were probably concatenated
with a tool that is not Unicode-aware.

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Craig Ringer 2014-03-25 04:00:34 Re: Global flag
Previous Message Craig Ringer 2014-03-25 03:51:07 Re: psql blows up on BOM character sequence