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

From Itagaki Takahiro
Subject Re: UTF8 with BOM support in psql
Date
Msg-id 20091118130339.A493.52131E4D@oss.ntt.co.jp
Whole thread Raw
In response to Re: UTF8 with BOM support in psql  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: UTF8 with BOM support in psql
List pgsql-hackers
Andrew Dunstan <andrew@dunslane.net> wrote:

> Itagaki Takahiro wrote:
> >  Multi-byte scripts
> > without encoding are always dangerous whether BOM is present or not.
> > I'd say we can always throw an error when we find queries that contain
> > multi-byte characters if no prior encoding declaration.
> 
> You will break a gazillion scripts that today work quite happily if you do.

Sure. That's why I didn't send a patch for it :)
If by any chance we do so, we'll have a boolean option to disable the check.

> Maybe there is a case for a extra command line switch to set the initial 
> client encoding for psql, which would make that a little easier and less 
> obscure to do. Would that make things simpler for you?

No. There are complex reasons on Windows in Japan. The client encoding is
always SJIS because of Windows restriction, but the database is initialized
with UTF8. Simple interactive works with psql are done under SJIS encoding,
but some scripts are written in UTF8 because it matches the server encoding.
(Of course the script is executed as "psql -f utf8.sql > out.txt")

I don't want user to check the encoding of scripts before executing --
it is far from fail-safe.

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center




pgsql-hackers by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: plpgsql: open for execute - add USING clause
Next
From: Robert Haas
Date:
Subject: Re: operator exclusion constraints