psycopg2+postgres check default charset of db or table
psycopg2+postgres check default charset of db or table
От:
Peter Irbizon <peterirbizon@gmail.com>
Дата:
Hello guys,
I am using python 2.7 and psycopg2. How could I find out default charset used by database? I would like to check it and then according to used charset decode returned strings.
I tried "select rdb$character_set_name from rdb$database" but it seems it doesn't work for postgres. thank you
Re: psycopg2+postgres check default charset of db or table
От:
Joe Abbate <jma@freedomcircle.com>
Дата:
On 04/18/2012 08:12 PM, Peter Irbizon wrote: > I am using python 2.7 and psycopg2. How could I find out default charset > used by database? I would like to check it and then according to used > charset decode returned strings. > > I tried "select rdb$character_set_name from rdb$database" but it > seems it doesn't work for postgres. thank you "SHOW server_encoding" will show the character encoding after you connect. "SELECT pg_encoding_to_char(encoding) FROM pg_database WHERE datname = %(dbname)s" can be used to find out the encoding before connecting (connecting to the postgres db instead). Joe