Re: UTF8 with BOM support in psql

David Christensen <david@endpoint.com>

From: David Christensen <david@endpoint.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Andrew Dunstan <andrew@dunslane.net>, Bruce Momjian <bruce@momjian.us>, Itagaki Takahiro <itagaki.takahiro@oss.ntt.co.jp>, pgsql-hackers@postgresql.org
Date: 2009-10-20T16:02:02Z
Lists: pgsql-hackers
On Oct 20, 2009, at 10:51 AM, Tom Lane wrote:

> Andrew Dunstan <andrew@dunslane.net> writes:
>> What I think we might sensibly do is to eat the leading BOM of an SQL
>> file iff the client encoding is UTF8, and otherwise treat it as just
>> bytes in whatever the encoding is.
>
> That seems relatively non-risky.

Is that only when the default client encoding is set to UTF8  
(PGCLIENTENCODING, whatever), or will it be coded to work with the  
following:

$ PGCLIENTENCODING=...nonutf8...
$ psql -f <file>

Where <file> is:
<BOM>
...

SET CLIENT ENCODING 'utf8';

...
EOF

Regards,

David
--
David Christensen
End Point Corporation
david@endpoint.com