Re: Question for Postgres 8.3

Поиск
Список
Период
Сортировка
От Gregory Stark
Тема Re: Question for Postgres 8.3
Дата
Msg-id 87hcgn4ynz.fsf@oxford.xeocode.com
обсуждение исходный текст
Ответ на Re: Question for Postgres 8.3  (rihad <rihad@mail.ru>)
Список 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 по дате отправления:

Предыдущее
От: rihad
Дата:
Сообщение: Upgrading from 8.3RC2 to release
Следующее
От: Hermann Muster
Дата:
Сообщение: Re: msvcr80.dll and PostgreSQL 8.3 under Windows XP