From: | Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> |
---|---|
To: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: More message encoding woes |
Date: | 2009-04-07 18:49:11 |
Message-ID: | 49DBA027.3010809@enterprisedb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Peter Eisentraut wrote:
> On Tuesday 07 April 2009 13:09:42 Heikki Linnakangas wrote:
>> Patch attached. Instead of checking for LC_CTYPE == C, I'm checking
>> "pg_get_encoding_from_locale(NULL) == encoding" which is more close to
>> what we actually want. The downside is that
>> pg_get_encoding_from_locale(NULL) isn't exactly free, but the upside is
>> that we don't need to keep this in sync with the rules we have in CREATE
>> DATABASE that enforce that locale matches encoding.
>
> I would have figured we can skip this whole thing when LC_CTYPE != C, because
> it should be guaranteed that LC_CTYPE matches the database encoding in this
> case, no?
Yes, except if pg_get_encoding_from_locale() couldn't figure out what PG
encoding LC_CTYPE corresponds to. We let CREATE DATABASE to go ahead in
that case, trusting that the user knows what he's doing. I suppose we
can extend that trust to this case too, and assume that the encoding of
LC_CTYPE actually matches the database encoding.
Or if the encoding is UTF-8 and you're running on Windows, although on
Windows we want to always call bind_textdomain_codeset(). Or if the
database encoding is SQL_ASCII, although in that case we don't want to
call bind_textdomain_codeset() either.
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | John Lister | 2009-04-07 18:54:19 | Array types |
Previous Message | Tom Lane | 2009-04-07 18:41:47 | Re: Path separator |