Search Postgresql Archives

Re: strange encoding behavior

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux