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 20091117113046.14F9.52131E4D@oss.ntt.co.jp
Whole thread Raw
In response to Re: UTF8 with BOM support in psql  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: UTF8 with BOM support in psql
List pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Andrew Dunstan <andrew@dunslane.net> writes:
> > if you need to, using PGOPTIONS or psql 
> > "dbname=mydb options='-c client_encoding=utf8'".
> 
> It could also be set in ~/.psqlrc, which would probably be the most
> convenient method for regular users of UTF8 files who need to talk
> to non-UTF8 databases.

It's nonsense. Users often use scripts written in difference encodings
at once. Encoding information should be packed in script file itself.
We should not force users to open script files and check its encoding
before they execute the files.

BTW, I have an idea to improve handling of per-file encoding.
We continue to use the encoding settings specified in included file
at \i command. But should the setting be reverted at the end of file?
ie.

=# \encoding SJIS
=# \i script-in-utf8.sql
=# -- encoding should be SJIS here.

If encoding setting is reverted, 
> "Eat BOM at beginning of file and <<set client encoding to UTF-8>>"
will be much safer.

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




pgsql-hackers by date:

Previous
From: "Greg Sabino Mullane"
Date:
Subject: Re: Listen / Notify rewrite
Next
From: Itagaki Takahiro
Date:
Subject: Re: TRIGGER with WHEN clause