Re: invalidly encoded strings

Поиск
Список
Период
Сортировка
От Albe Laurenz
Тема Re: invalidly encoded strings
Дата
Msg-id D960CB61B694CF459DCFB4B0128514C22FB99F@exadv11.host.magwien.gv.at
обсуждение исходный текст
Ответ на invalidly encoded strings  (Andrew Dunstan <andrew@dunslane.net>)
Ответы Re: invalidly encoded strings  (Andrew Dunstan <andrew@dunslane.net>)
Список pgsql-hackers
Tom Lane wrote:
>> . for chr() under UTF8, it seems to be generally agreed
>> that the argument should represent the codepoint and the
>> function should return the correspondingly encoded character.
>> If so, possible the argument should be a bigint to
>> accommodate the full range of possible code points.
>> It is not clear what the argument should represent for other
>> multi-byte encodings for any argument higher than 127.
>> Similarly, it is not clear what ascii() should return in
>> such cases. I would be inclined just to error out.
>
> In SQL_ASCII I'd argue for allowing 0..255.  In actual MB
> encodings, OK with throwing error.

I'd like to repeat my suggestion for chr() and ascii().

Instead of the code point, I'd prefer the actual encoding of
the character as argument to chr() and return value of ascii().

The advantage I see is the following:

- It would make these functions from oracle_compat.c compatible with Oracle (Oracle's chr() and ascii() work the way I
suggest).

I agree with Tom's earlier suggestion to throw an error for
chr(0), although this is not what Oracle does.

Of course, if it is generally perceived that the code point
is more useful than the encoding, then Oracle compliance
is probably secondary.

Yours,
Laurenz Albe


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: invalidly encoded strings
Следующее
От: Gregory Stark
Дата:
Сообщение: Re: invalidly encoded strings