Skip to content
Advertisement

How to fix Encoding error utf-8 – PostgreSQL

I am following instructions online to create a database in pgAdmin4. I have successfully imported a csv file and created a table. However, I cannot select anything from the table.

My code is:

SELECT * FROM transfers;

Error message is: ‘utf-8’ codec can’t decode byte 0xc3 in position 0: unexpected end of data

Running ‘show server_encoding’ gives “UTF8” in the output. Running ‘show client_encoding gives “UNICODE” in the output.

Advertisement

Answer

Maybe you saved an excel file as csv and imported to postgre, if so, open excel, create a blank csv file and copy/paste your excel data to there and save. Delete your previous postgre table and import newly created csv file again.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement