Re: Question for Postgres 8.3 - Mailing list pgsql-general

From Gregory Stark
Subject Re: Question for Postgres 8.3
Date
Msg-id 87hcgn4ynz.fsf@oxford.xeocode.com
Whole thread Raw
In response to Re: Question for Postgres 8.3  (rihad <rihad@mail.ru>)
List pgsql-general
"rihad" <rihad@mail.ru> writes:

>> If you want to support multiple encodings, the only safe locale choice
>> is (and always has been) C.
>
> I should be ashamed for asking this, but would someone care to tell me how
> encoding differs from locale?

One you missed is a character set, which is just a set of possible characters
(not bytes, abstract things called characters).

An encoding is a mapping from a series of binary bytes to a series of
characters from a character set, like UTF-8 or Big5 or just plain ascii.

A locale is a set of rules for how to sort (collation), format dates, numbers,
currencies, etc like es_US or jp_JP

The problem is that a locale needs to know what the string it's looking is at
to decide how to sort it, so it has to be designed for a particular encoding.
In Unix that encoding is tacked on the end like en_US.UTF-8.

C is a bit of special case since it sorts based on the binary representation
rather than the characters. That's true for any 1-byte encoding based locale
but C is more predictable when you actually have binary data.

--
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com
  Ask me about EnterpriseDB's On-Demand Production Tuning

pgsql-general by date:

Previous
From: rihad
Date:
Subject: Upgrading from 8.3RC2 to release
Next
From: Hermann Muster
Date:
Subject: Re: msvcr80.dll and PostgreSQL 8.3 under Windows XP