Re: Using UTF strings in pg8.3 - storing hexadecimal values in bytea columns
| От | Mario Splivalo |
|---|---|
| Тема | Re: Using UTF strings in pg8.3 - storing hexadecimal values in bytea columns |
| Дата | |
| Msg-id | 49196C31.6010409@megafon.hr обсуждение исходный текст |
| Ответ на | Re: Using UTF strings in pg8.3 - storing hexadecimal values in bytea columns (Mario Splivalo <mario.splivalo@megafon.hr>) |
| Ответы |
Postgres version of all_ind_cols
|
| Список | pgsql-sql |
Mario Splivalo wrote:
> But, if I want it other way around, I get the error:
>
> test1=# select envode(E'\305', 'hex');
> ERROR: invalid byte sequence for encoding "UTF8": 0xc5
> HINT: This error can also happen if the byte sequence does not match
> the encoding expected by the server, which is controlled by
> "client_encoding".
> test1=#
>
> Is there a way to circumvent encoding when dealing with binary data? Or
> am I completely confused here and have no clue what am I talking about?
>
Now, this works:
test1=# select encode(decode('C5', 'hex'), 'hex'); encode
-------- c5
(1 row)
I see that my client encoding has a problem interpreting '\xC5':
test1=# select E'\xC5';
ERROR: invalid byte sequence for encoding "UTF8": 0xc5
HINT: This error can also happen if the byte sequence does not match
the encoding expected by the server, which is controlled by
"client_encoding".
So the only way is to use decode function, right?
Mike
В списке pgsql-sql по дате отправления: