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