Skip site navigation (1) Skip section navigation (2)

client encoding name normalization in psycopg 2.4

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: psycopg(at)postgresql(dot)org
Subject: client encoding name normalization in psycopg 2.4
Date: 2011-04-07 19:46:56
Message-ID: (view raw, whole thread or download thread mbox)
Lists: psycopg
Psycopg 2.4 now tries to map the PostgreSQL client encoding to a Python
codec.  But it fails to consider some variant spellings.  For example, I


in my environment, which completely breaks the new psycopg version with

no Python codec for client encoding 'UTF-8'

(The underlying reason for this is that I use

export PGCLIENTENCODING=$(locale charmap)

which gives variant spelling of encoding names across operating

The PostgreSQL backend normalizes an encoding name by removing all
non-alnum characters from it.  I suggest psycopg do the same.

Attached is a patch that implements that.  Note that the PostgreSQL
backend version of this actually lowercases the encoding names during
normalization.  I have made this patch uppercase them to keep the patch
smaller, but you may want to consider doing the lowercasing, to keep
things consistent.

Attachment: psycopg-clientencoding-fix.patch
Description: text/x-patch (3.9 KB)


psycopg by date

Next:From: Mark SienkiewiczDate: 2011-04-07 20:40:29
Subject: portable DBAPI auto-increment
Previous:From: Federico Di GregorioDate: 2011-04-05 09:59:25
Subject: Re: psycopg and the GPL

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group