Yes, I think it may be done by using SET CLIENT ENCODING TO UNICODE after opening the connection. At the moment I am doing it in another way - through a PGCLIENTENCODING environment variable (though I am not sure if it will work correctly all the time, so SET CLIENT ENCODING would be the preferred option to use).