我的数据包含特殊字符,比如德语元音变音符。
p=structure(list(ppl_code = c(992621L, 992381L, 992136L, 991989L,
991898L, 991759L, 991681L, 991593L, 991294L, 991036L, 990934L,
990751L, 990535L, 990411L, 990182L, 989507L), proj_name = c("klo",
"Dalbygda", "Oosterhorn", "Hån", "Yatir", "Montigny la Cour",
"Valle Hermoso", "Acciona Honawad - 120 MW", "Apfeltrang", "RiaBlades",
"General Acha", "Lindau-Böhlitz", "Apfeltrang", "Alcazar Round 2",
"Peckelsheim", "Linnich 3")), .Names = c("ppl_code", "proj_name"
), row.names = 15:30, class = "data.frame")
当我尝试将其写入mysql数据库时:
conn <- dbConnect(
drv = RMySQL::MySQL(),
dbname = "mydb",
host = "#####",
username = "#####",
password = "#####")
dbWriteTable(conn, value = p, name = "MyTable",row.names=FALSE)
我得到了编码错误:
could not run statement: Invalid utf8 character string: 'Lindau-B'
我查了好几篇关于这个问题的帖子,像这里和这里,但它们都是一般性的解释,没有一个明确的解决办法!有谁能帮我提出一个明确的问题来解决这个问题?
1条答案
按热度按时间vnjpjtjt1#
你需要宣布使用utf-8。