Re: UTF8 with BOM support in psql - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: UTF8 with BOM support in psql
Date
Msg-id 1258403827.21773.9.camel@vanquo.pezone.net
Whole thread Raw
In response to Re: UTF8 with BOM support in psql  (Itagaki Takahiro <itagaki.takahiro@oss.ntt.co.jp>)
Responses Re: UTF8 with BOM support in psql
Re: UTF8 with BOM support in psql
Re: UTF8 with BOM support in psql
List pgsql-hackers
On ons, 2009-10-21 at 13:11 +0900, Itagaki Takahiro wrote:
> Sure. Client encoding is declared in body of a file, but BOM is
> in head of the file. So, we should always ignore BOM sequence
> at the file head no matter what client encoding is used.
> 
> The attached patch replace BOM with while spaces, but it does not
> change client encoding automatically. I think we can always ignore
> client encoding at the replacement because SQL command cannot start
> with BOM sequence. If we don't ignore the sequence, execution of
> the script must fail with syntax error.

OK, I think the consensus here is:

- Eat BOM at beginning of file (as you implemented)

- Only when client encoding is UTF-8 --> please fix that

I'm not sure if replacing a BOM by three spaces is a good way to
implement "eating", because it might throw off a column indicator
somewhere, say, but I couldn't reproduce a problem.  Note that the U
+FEFF character is defined as *zero-width* non-breaking space.



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Unpredictable shark slowdown after migrating to 8.4
Next
From: Greg Smith
Date:
Subject: Re: write ahead logging in standby (streaming replication)