EnterpriseDB / mysql_fdw

PostgreSQL foreign data wrapper for MySQL
Other
521 stars 160 forks source link

fdw not supported Chinese #2

Open huiflyy opened 12 years ago

huiflyy commented 12 years ago

query the foreign table contains Chinese content, shows '????'

mysql 5.0.77 utf8 postgresql 9.1 utf8

papazis commented 11 years ago

I am using version 1.0.1 of mysql_fdw and have run on the same problem with Greek I have solved the problem by editing the source file mysql_fdw.c and adding right before each

mysql_real_connect()

the following commands mysql_options(conn, MYSQL_SET_CHARSET_NAME, "utf8"); mysql_options(conn, MYSQL_INIT_COMMAND, "SET NAMES utf8");

It is a simple solution that works fine if all of your databases, that you are going to connect to, are UTF8.

papazis commented 11 years ago

--- mysql_fdw.c.orig 2013-02-03 16:34:32.000000000 +0200 +++ mysql_fdw.c 2013-03-07 16:23:33.000000000 +0200 @@ -422,6 +422,9 @@ errmsg("failed to initialise the MySQL connection object") ));