Re: [GENERAL] Convert from hex to string

2015-12-06 Thread Jim Nasby
On 11/26/15 1:12 AM, Francisco Olarte wrote: Anyway, I think people should be told to respect types, and people should be teach that strings are sequences of characters, that to do what people think is 'hex encoding' ( two digits per*byte*, no delimiter ), you need to first transform the string

Re: [GENERAL] Convert from hex to string

2015-11-26 Thread Adrian Klaver
On 11/25/2015 11:12 PM, Francisco Olarte wrote: Hi Adrian: On Wed, Nov 25, 2015 at 9:33 PM, Adrian Klaver wrote: I will grant you that working with encodings is like working with timestamps, explicit is better. The thing I am having a problem with is how not knowing

Re: [GENERAL] Convert from hex to string

2015-11-25 Thread Adrian Klaver
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

[GENERAL] Convert from hex to string

2015-11-25 Thread Yuriy Rusinov
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

Re: [GENERAL] Convert from hex to string

2015-11-25 Thread Adrian Klaver
On 11/25/2015 08:56 AM, Francisco Olarte wrote: Hello Yuriy... On Wed, Nov 25, 2015 at 4:47 PM, Yuriy Rusinov wrote: 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

Re: [GENERAL] Convert from hex to string

2015-11-25 Thread Francisco Olarte
Hello Yuriy... On Wed, Nov 25, 2015 at 4:47 PM, Yuriy Rusinov wrote: > 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

Re: [GENERAL] Convert from hex to string

2015-11-25 Thread Francisco Olarte
On Wed, Nov 25, 2015 at 6:22 PM, Adrian Klaver wrote: >> 1.- Convert it to a bytea, in a controlled encoding: convert_to(string >> text, dest_encoding name) => bytea >> 2.- Then encode the bytes in hex: encode(data bytea, format text) => text >> >> then, to revert it

Re: [GENERAL] Convert from hex to string

2015-11-25 Thread Adrian Klaver
On 11/25/2015 08:56 AM, Francisco Olarte wrote: Hello Yuriy... On Wed, Nov 25, 2015 at 4:47 PM, Yuriy Rusinov wrote: 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

Re: [GENERAL] Convert from hex to string

2015-11-25 Thread Yuriy Rusinov
Thanks a lot. All works fine. On Wed, Nov 25, 2015 at 9:49 PM, Francisco Olarte wrote: > Mail pingpong day. ;-) > > On Wed, Nov 25, 2015 at 7:27 PM, Adrian Klaver > wrote: > > > postgres@latin1_db=# \encoding > > UTF8 > > This does not

Re: [GENERAL] Convert from hex to string

2015-11-25 Thread Francisco Olarte
Mail pingpong day. ;-) On Wed, Nov 25, 2015 at 7:27 PM, Adrian Klaver wrote: > postgres@latin1_db=# \encoding > UTF8 This does not matter, as you are sending/receiving hex data, and the encoding done when sending query results to you gets reverted when you send

Re: [GENERAL] Convert from hex to string

2015-11-25 Thread Adrian Klaver
On 11/25/2015 10:49 AM, Francisco Olarte wrote: Mail pingpong day. ;-) On Wed, Nov 25, 2015 at 7:27 PM, Adrian Klaver wrote: postgres@latin1_db=# \encoding UTF8 This does not matter, as you are sending/receiving hex data, and the encoding done when sending query

Re: [GENERAL] Convert from hex to string

2015-11-25 Thread Francisco Olarte
Hi Adrian: On Wed, Nov 25, 2015 at 9:33 PM, Adrian Klaver wrote: > I will grant you that working with encodings is like working with > timestamps, explicit is better. The thing I am having a problem with is how > not knowing the context of the bytea value is different