Skip to Content

How to set charset for MySQL in RODBC?

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 field names is OK, but for the data, all of the chinese characters are shown as ?.

I have read the RODBC manual and it said:

If it is possible to set the DBMS or ODBC driver to communicate in the character set of the R session then this should be done. For example, MySQL can set the communication character set via SQL, e.g. SET NAMES 'utf8'.

I guess this is the problem, but how can I provide this command to MySQL via RODBC? Thanks!