I am struggling to display Japanese characters in a dataframe, which have been retrieved from a MySQL database using the RMySQL package. Japanese characters display fine if I paste a string from the database into a variable, which then has the Encoding 'UTF-8'. The Encoding of the dataframe column is 'unknown' and I haven't managed to change it using iconv.
A line of the database is:
1.00 20120801 4520000000000.00 1.00 379.00 142.00 北日本フード スーパー極上キムチ 330g
Retrieved using:
rs <- dbSendQuery(con, "select * from sales");
data <- fetch(rs, n=-1)
First row of data:
1 1 20120801 4.52e+12 1 379 142 ?????????????????????\r
Any help greatly appreciated.
The problem seems to be fixed by adding the following line before retrieving that data:
rs <- dbSendQuery(con, 'set character set "utf8"')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With