Re: strange encoding behavior

Поиск
Список
Период
Сортировка
От Albe Laurenz
Тема Re: strange encoding behavior
Дата
Msg-id 52EF20B2E3209443BC37736D00C3C1380B0918F4@EXADV1.host.magwien.gv.at
обсуждение исходный текст
Ответ на strange encoding behavior  (Jeff Davis <jdavis@laika.com>)
Ответы Re: strange encoding behavior  (Jeff Davis <jdavis@laika.com>)
Список pgsql-general
Jeff Davis wrote:
> I have a UTF8 encoded database. I can do
>
> => SELECT '\xb9'::text;
>
> But that seems to be the only way to get an invalid utf8 byte sequence
> into a text type.
[...]
> So, if I were to sum this up in a single question, why does cstring
not
> accept invalid utf8 sequences? And if it doesn't, why are they allowed
> in any text type?

I would say that it should be impossible to get invalid UTF-8 bytes
into a text on an UTF-8 database, and my opinion is that it is a bug or
oversight if a typecast allows you to do so.

The program you are talking about that needs to be able to store
arbitrary bytes in a text column should be changed - maybe it is enough
to change the data type of the database column from 'text' to 'bytea'.

Yours,
Laurenz Albe

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

Предыдущее
От: brian
Дата:
Сообщение: Re: How to determine initdb parameters on old database?
Следующее
От: Hugo
Дата:
Сообщение: Fwd: how to check SQLSTATE