On 11/25/2015 07:47 AM, Yuriy Rusinov wrote:
> Hello, Colleagues !
>
> I have to transform string, encoded to hexadecimal to text, but if I try to
> select encode('Qt is great!', 'hex'); I receive valid and correct results
>
> 517420697320677265617421
>
> but if I try to select decode ('517420697320677265617421', 'hex'), I
> receive the same string, such as
> '\x517420697320677265617421, which way I have to do for valid convert
> to/from hexadecimal ?
aklaver@test=> select encode('Qt is great!', 'hex');
encode
--------------------------
517420697320677265617421
(1 row)
aklaver@test=> select decode ('517420697320677265617421', 'hex');
decode
----------------------------
\x517420697320677265617421
(1 row)
aklaver@test=> select convert_from('\x517420697320677265617421', 'UTF8');
convert_from
--------------
Qt is great!
(1 row)
>
> Thanks for attention.
>
--
Adrian Klaver
adrian.klaver@aklaver.com