UTF8 encoding using RMySQL

我与影子孤独终老i 提交于 2019-12-06 15:53:30
Christophe D.

I find something a bit tricky but works for me :

you have to manually define the col of your data frame to utf-8 like this :

x <- "Wünsche"
Encoding(x) <- "UTF-8"
x
[1] "Wünsche"

Think you have to do this to all your strings vector

EDIT :

Take a look here
seems to fix the same problem by adding 'set character set "utf8"'inside the dbSendQuery()

When trying to use utf8/utf8mb4, if you see Mojibake, check the following. This discussion also applies to Double Encoding, which is not necessarily visible.

  • The bytes to be stored need to be utf8-encoded.
  • The connection when INSERTing and SELECTing text needs to specify utf8 or utf8mb4.
  • The column needs to be declared CHARACTER SET utf8 (or utf8mb4).
  • HTML should start with <meta charset=UTF-8>.
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!