L.S.
It seems that '\encoding' only shows the correct client encoding if any
changes are applied by using '\encoding' itself.
If the client encoding is changed by using 'set names' or 'set
client_encoding', the result of '\encoding' will still be the old one used.
However, the encoding seems to be changed, as 'show client_encoding' will
show.
Regards,
Frank van Vugt