Using psql to insert character codes

From: Ian Barwick <barwick(at)gmx(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Using psql to insert character codes
Date: 2003-05-10 14:20:24
Message-ID: 200305101620.24605.barwick@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


Say using psql I wish to insert a character into a VARCHAR / TEXT / whatever
column using the its hexadecimal representation in the relevant character set
/ encoding. E.g.: C3A4, which represents the character 'ä' (lower case a with
umlaut) in UTF-8.

I can do this:
INSERT INTO my_tbl (unitxt) VALUE(encode(decode('c3a4','hex'), 'escape'))

Is there any other, shorter way of doing the same?

Ian Barwick
barwick(at)gmx(dot)net

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Randall Lucas 2003-05-10 16:15:07 Re: Using psql to insert character codes
Previous Message Bruno Wolff III 2003-05-09 21:36:48 Re: epoch to timestamp