Re: invalidly encoded strings

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: invalidly encoded strings
Дата
Msg-id 17382.1189539075@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: invalidly encoded strings  (Alvaro Herrera <alvherre@commandprompt.com>)
Список pgsql-hackers
Alvaro Herrera <alvherre@commandprompt.com> writes:
> Tom Lane wrote:
>> I think really the technically cleanest solution would be to make
>> convert() return bytea instead of text; then we'd not have to put
>> restrictions on what encoding or locale it's working inside of.
>> However, it's not clear to me whether there are valid usages that
>> that would foreclose.  Tatsuo mentioned length() but bytea has that.

> But length(bytea) cannot count characters, only bytes.

So what?  If you want characters, just count the original text string.
Encoding conversion won't change that.

> Hmm, I wonder if counting chars is consistent regardless of the
> encoding the string is in.  To me it sounds like it should, in which
> case it works to convert to the DB encoding and count chars there.

A conversion that isn't one-for-one is not merely an encoding conversion
IMHO.
        regards, tom lane


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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: invalidly encoded strings
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pg_dump and money type