set_client_encoding (PGconn)

    /*
     * call-seq:
     *    conn.set_client_encoding( encoding )
     *
     * Sets the client encoding to the _encoding_ String.
     */
    static VALUE
    pgconn_set_client_encoding(VALUE self, VALUE str)
    {
            Check_Type(str, T_STRING);
            if ((PQsetClientEncoding(get_pgconn(self), StringValuePtr(str))) == -1){
                    rb_raise(rb_ePGError, "invalid encoding name: %s",StringValuePtr(str));
            }
            return Qnil;
    }