| From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
|---|---|
| To: | Yuriy Rusinov <yrusinov(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org |
| Subject: | Re: Convert from hex to string |
| Date: | 2015-11-25 16:26:06 |
| Message-ID: | 5655E11E.70304@aklaver.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
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(at)test=> select encode('Qt is great!', 'hex');
encode
--------------------------
517420697320677265617421
(1 row)
aklaver(at)test=> select decode ('517420697320677265617421', 'hex');
decode
----------------------------
\x517420697320677265617421
(1 row)
aklaver(at)test=> select convert_from('\x517420697320677265617421', 'UTF8');
convert_from
--------------
Qt is great!
(1 row)
>
> Thanks for attention.
>
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Francisco Olarte | 2015-11-25 16:56:03 | Re: Convert from hex to string |
| Previous Message | Yuriy Rusinov | 2015-11-25 15:47:06 | Convert from hex to string |