I'm trying to do a select on a UTF8 DB, but the Results do not contain proper UTF-8 characters. This is for german characters like "ä", "ö", "ü"
screen: https://i.stack.imgur.com/AwH6z.jpg
The client_encoding is set to UTF8.
CHCP is 850.
When I do psql -c "ö" -d ...-U postgres I get ERROR: invalid byte sequence for encoding "UTF8": 0xf6 HINT: This error can also happen if the byte sequence does not match the encodi ng expected by the server, which is controlled by "client_encoding".
The Database is definetely UTF8, when I do the query in pgadmin it works properly.
How to do this right?
---Edit---
After setting the right encoding for the cmd the command is working, but the results still can't be stored in powershell variables / be exported via powershell.
using \copy to perform the export and reading the file in again solves the problem.
\copy (Select 'ö') To 'e:/test.csv' With CSV