How to define the SET CLIENT_ENCODING = UTF8 permanently?

Asked

Viewed 3,999 times

4

I am using Postgresql in my DATABASE Accent information is being recorded with accent problems.

Ex:

It records like it is.

Shark records as Shark

The encoding of my DATABASE and my server are using the UTF8 as ENCODING. Only that Postgresql has an environment variable called CLIENT_ENCODING which is responsible for controlling the encoding used by the client that is connected to the database server.

When I send the command SHOW

SHOW CLIENT_ENCODING;

Turns out that my ENCODING is the UNICODE

So every time, I have to use the remote SET, in each query tool window, to be able to change its value and correct the accents. For example:

SET CLIENT_ENCODING = 'LATIN1';

Note: if I put EVER SINCE I WAS 8, it does not recognize the special characters. I do not know why, since my bank is in EVER SINCE I WAS 8. He should recognize and show the accents when I set UTF8.

MY QUESTION IS:

Please, how can I let my client encoding according to the bank (UTF8), so that these mistakes don’t happen with the accent?

2 answers

1

0

You can set environment variables directly on ROLE responsible for the session/connection, for example:

ALTER ROLE foobar SET CLIENT_ENCODING = 'UTF8';

Browser other questions tagged

You are not signed in. Login or sign up in order to post.