4

When querying from certain tables, I'll often receive the error:

character with byte sequence 0xef 0xbf 0xbd in encoding "UTF8" has no equivalent in encoding "WIN1252"

Varying bytes, but you get the idea. I can solve this by doing:

set client_encoding to 'UTF8';

But the (very) annoying thing is, I have to do this client_encoding set every. Single. Time. I open postgres. How do I set this to default?

Also, I am not asking how to change the encoding of a table's data, or of databases I create from now on--that's a different issue.

2

You can also set it as a default for any user or role (takes effect after a new connection is established):

ALTER ROLE <rolename> SET client_encoding = 'UTF8';
0

You can either set the environment variable PGCLIENTENCODING in the operating system or include the set command in .psqlrc if you only need it for psql

  • I actually already have "SET client_encoding = 'UTF8'; " in my psqlrc.conf file, which is located where that doc specifies. Must have come from my trying to fix this problem originally... but I'm still seeing it. – Amalgovinus Apr 28 '16 at 22:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.