Hello again!
I have now managed to work out where I was going wrong.
However, I still get the line:
NOTICE: Unrecognized variable client_encoding
when executing a psql command, however it doesn't seem to affect anything.
Has anyone else experienced this?