Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

PostgreSQL: 22021: invalid byte sequence for encoding "UTF8" ODBC

Hello v-danhe-msft 

 

Please help me.. I have the same issue when I get data from ODB or directly from PostgreSql.

Some tables I can import the table to powerquery and see it, but i cant aply it to powerbi desktop.

Other tables i cant even see it at powerquery.

 

Failed to save modifications to the server. Error returned: 'Erro do OLE DB ou ODBC: [datasource.error] PostgreeSQL: 22021: invalid byte sequence for encoding "UTF8": 0xc7 0x4f. ' .

 

From ODBC:

DataSource.Error: ODBC: ERROR [22021] ERROR: invalid byte sequence for encoding "UTF8": 0xe9 0x20 0x41;
Error while executing the query
Detalhes:
DataSourceKind=Odbc
DataSourcePath=dsn=PostgreSQL35W32b
OdbcErrors=[Table]

 

FROM POSTGRE:

DataSource.Error: PostgreSQL: 22021: invalid byte sequence for encoding "UTF8": 0xc7 0xc3
Detalhes:
DataSourceKind=PostgreSQL
DataSourcePath=000.000.0.0;TESTE
Message=22021: invalid byte sequence for encoding "UTF8": 0xc7 0xc3
ErrorCode=-2147467259

 

MY DATABASE:

CREATE DATABASE "TESTE"
WITH OWNER = postgres
ENCODING = 'SQL_ASCII'
TABLESPACE = pg_default
LC_COLLATE = 'Portuguese_Brazil.1252'
LC_CTYPE = 'Portuguese_Brazil.1252'
CONNECTION LIMIT = -1;

ALTER DATABASE "TESTE"
SET DateStyle = 'iso, mdy';
ALTER DATABASE "TESTE"
SET bytea_output = 'escape';
ALTER DATABASE "TESTE"
SET standard_conforming_strings = 'off';

 

MY ODBC Config:

datasourse int-8 as default

extra op 0x0

byte as LO

  • Anonymous's avatar
    Anonymous
    6 years ago

    SET UP ODBC AS "POSTGRESQL ANSI"

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    The ERP developer of this database told me that I need to make PowerBi to read the database as "SQL_ASCII" - not as utf8.

    Is it right?

    How can I solve it?

    • Anonymous's avatar
      Anonymous
      Not applicable

      SET UP ODBC AS "POSTGRESQL ANSI"