tds-fdw / tds_fdw

A PostgreSQL foreign data wrapper to connect to TDS databases (Sybase and Microsoft SQL Server)
Other
377 stars 101 forks source link

column names turned to be gibberish when it is Chinese in SQLSERVER #246

Open suishaojian opened 4 years ago

suishaojian commented 4 years ago

image

When I select the table from postgresql using tds_fdw. I got the gibberish test in column... How can I fixed this ? Appreciate it If any help !

GeoffMontee commented 4 years ago

Sorry, can you please clarify? Is the column name turning to gibberish, or is the column's value turning to gibberish, or are both turning to gibberish?

If the column name is turning to gibberish, can you please clarify how exactly you are retrieving the column metadata?

suishaojian commented 4 years ago

It is the column name turning to gibberish , not the value. as follows , first two columns are correct (ID and TIME ) : image And I use this way to import schema from sqlserver to pg:

IMPORT FOREIGN SCHEMA dbo
    EXCEPT (mssql_table)
    FROM SERVER mssql_svr
    INTO public
    OPTIONS (import_default 'true');
SudoerWithAnOpinion commented 4 years ago

This looks like an encoding issue, can you verify the encoding used on both servers?

suishaojian commented 4 years ago

This looks like an encoding issue, can you verify the encoding used on both servers?

PG : UTF8 SqlServer : 936 which I think is GBK And I cannot change the encoding of PG into GBK ...

suishaojian commented 4 years ago

I am wondering should I set the freetds.conf and how to set ?

suishaojian commented 4 years ago

luckily I solved this problem this with setting freetds.conf and remove the charset from the options when I create the server .