Re: Convert from hex to string

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: Convert from hex to string
Дата
Msg-id 5655E11E.70304@aklaver.com
обсуждение исходный текст
Ответ на Convert from hex to string  (Yuriy Rusinov <yrusinov@gmail.com>)
Список 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@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


В списке pgsql-general по дате отправления:

Предыдущее
От: Yuriy Rusinov
Дата:
Сообщение: Convert from hex to string
Следующее
От: Francisco Olarte
Дата:
Сообщение: Re: Convert from hex to string