Re: does encrypt function support higher than basic ascii?

From: Richard Huxton <dev(at)archonet(dot)com>
To: Naoko Reeves <naoko(at)lawlogix(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: does encrypt function support higher than basic ascii?
Date: 2009-11-17 21:07:25
Message-ID: 4B03108D.60707@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Naoko Reeves wrote:
> Sorry, as Richard said the issue was me not converting bytea to text. The blow did it . thank you!
>
> SELECT convert_from((select decrypt(encrypt((select convert('aéiou','LATIN1', 'LATIN1')),'foo','aes'),'foo','aes')),'UNICODE')

I'm surprised you can't just do:

SELECT convert_from(
decrypt(
encrypt( 'aéiou'::bytea, 'foo', 'aes' )
, 'foo', 'aes'
)
, 'unicode'
)

You should be able to cast to bytea simply enough. Coming back the other
way, you do need to tell it what encoding you have through convert_from().

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Naoko Reeves 2009-11-17 21:10:41 Re: does encrypt function support higher than basic ascii?
Previous Message Naoko Reeves 2009-11-17 20:55:53 Re: does encrypt function support higher than basic ascii?