How to set charset for MySQL in RODBC?

后端 未结 2 619
暖寄归人
暖寄归人 2021-01-19 17:31

I have a data with chinese characters as field names and data, I have imported them from xls to access 2007 and export them to ODBC. Then I use RODBC to read them in R, the

2条回答
  •  伪装坚强ぢ
    2021-01-19 18:12

    I just found the cure. Don't know if I can post.

    1. Set up the MySQL database to be UTF-8 based;

    2. Set up the ODBC DSN and do NOT set the "character set" option.

    3. ch<-odbcConnect("mydb",DBMSencoding="UTF-8");

    That's it.

提交回复
热议问题