我正在尝试通过RPostgreSQL
包从 Postgres DB 获取一些数据。结果 data.frame 中的字符列具有unknown
编码:
Encoding(raw_orders$city)
[1] "unknown" "unknown" "unknown" "unknown" "unknown" "unknown" "unknown" "unknown" "unknown" "unknown" "unknown" "unknown"
尽管我将所有可以想象的编码标志都设置为 UTF-8:
> dbGetQuery(connection_postgres, "SHOW CLIENT_ENCODING")
client_encoding
1 UTF8
> dbGetQuery(connection_postgres, "SHOW SERVER_ENCODING")
server_encoding
1 UTF8
> Sys.getlocale()
[1] "en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8"
如何强制所有字符列使用 UTF-8 而无需通过手动设置Encoding()
?