I am reading and writing from MySQL tables which have utf8 encoding and a mix of numerical fields and text fields of Japanese characters. The tables can be read without problem and display properly in R but writing back to MySQL using dbWriteTable produces text output that contains unrecognisable characters. If I write the dataframe as a CSV file, I can then read it into MySQL successfully, so presumably I am missing something simple in using dbWriteTable. The R code is:
con <- dbConnect(RMySQL::MySQL(), user='root', password=pw, dbname=dbase)
dbGetQuery(con, 'set character set utf8')
dbWriteTable(con, 'assort', full_out)
dbDisconnect(con)
Thanks for any pointers.