Search Postgresql Archives

Re: does encrypt function support higher than basic ascii?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux