Encoding, Unicode, locales, etc.

From: Carlos Moreno <moreno_pg(at)mochima(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Encoding, Unicode, locales, etc.
Date: 2006-11-01 01:54:03
Message-ID: 4547FE3B.3020002@mochima.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Hi,

Even though I *think* I have a fairly clear understanding of encoding
and locale principles, I'm somewhat unsure of how some of the tools
available with PostgreSQL apply (or rather, how should they be used).

1) The way I understand it, encoding (character set) and locale are two
different things. Yet, I see that initdb allows me to specify the default
encoding (I can override it when creating the database) for the databases
that I create later, and also the locale(s). Why is it that the database
cluster is resrticted to a single locale (or single set of locales) instead
of being configurable on a per-database basis?

2) On the same token (more or less), I have a test database, for which
I ran initdb without specifying encoding or locale; then, I create a
database with UTF8 encoding. Then, from a psql console on the same
Linux machine that is running the server, I try lower of a string that
contains characters with accents (e.g., Spanish or French characters),
and it works as it should according to Spanish or French rules --- it
returns a string with the same characters in lowecase, with the same
accent. Why did that work? My Linux machine has all en_US.UTF-8
locales, and en_US is not even aware of characters with accents, so it
doesn't seem like it's taking by default the encoding from the OS. (is it
simply that the case is "too obvious" so by default case conversion
does the "obvious" thing?)

I have several other details in which I'm not too clear, but perhaps
with any responses or pointers that I might get for the above, it would
clarify the whole confusion?

BTW, I did read the online PG documentation --- the section
localization; the thing is, with everything that I read in there, my
reaction was more or less "ok, I knew that"; that is, it states facts
for which I know (or at least I think I know) the "theory", but it did
not clarify how to use the given tools.

Thanks,

Carlos
--

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2006-11-01 02:43:11 Re: RAM Based Disk Drive?
Previous Message Ron Johnson 2006-10-31 23:59:06 Text manipulation tools (was Re: postgres import)