Can I force Postgres multi client_encoding, or auto convert to the appropriate encoding?
21:42 30 Oct 2019

I have a DB server and client with UTF8 encoding, and the client sometimes write data in SJIS or LATIN1, which results in this error:

ERROR: invalid byte sequence for encoding "UTF8": 0xd5 0x78

I tried to set the client_encoding to SJIS for this data, and it worked. I wonder why this error happened, because I thought UTF8 supported both of them as described in the docs:

https://www.postgresql.org/docs/11/multibyte.html#id-1.6.10.5.7

Is there any way to make Postgres automatically convert without setting encoding manually?

postgresql encoding