RPostgres没有设置正确的字符编码

时间:2016-06-07 13:15:11

标签: r postgresql utf-8 character-encoding rpostgresql

我正试图通过RPostgreSQL包从Postgres数据库中获取一些数据。结果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()手动设置它?

0 个答案:

没有答案