Open dpprdan opened 6 years ago
Somewhat related to #52, queries with non-ASCII characters do not work (on Windows), unless they are encoded as UTF-8
library(RPostgreSQL) #> Loading required package: DBI cities <- data.frame(city = c("New York", "Rio", "Brüssel")) con <- dbConnect( PostgreSQL(), host = "localhost", dbname = "postgres", user = Sys.getenv("pg_localhost_user"), password = Sys.getenv("pg_localhost_password") ) dbWriteTable(con, "cities", cities, temporary = TRUE) #> [1] TRUE dbReadTable(con, "cities") #> city #> 1 New York #> 2 Rio #> 3 Brüssel query <- "SELECT * FROM cities WHERE city = 'Brüssel'" dbGetQuery(con, query) #> Error in postgresqlExecStatement(conn, statement, ...) : #> RS-DBI driver: (could not Retrieve the result : FEHLER: ungültige Byte-Sequenz für Kodierung #> »UTF8«: 0xfc #> ) NULL #> Warning in postgresqlQuickSQL(conn, statement, ...): Could not create #> execute: SELECT * FROM cities WHERE city = 'Brüssel' #> NULL
It works fine, when the query is also encoded as UTF-8
query_utf8 <- enc2utf8(query) dbGetQuery(con, query_utf8) #> row.names city #> 1 3 Brüssel dbRemoveTable(con, "cities") #> [1] TRUE dbDisconnect(con) #> [1] TRUE
Somewhat related to #52, queries with non-ASCII characters do not work (on Windows), unless they are encoded as UTF-8
It works fine, when the query is also encoded as UTF-8
Session info
``` r devtools::session_info() #> Session info ------------------------------------------------------------- #> setting value #> version R version 3.4.3 (2017-11-30) #> system x86_64, mingw32 #> ui RTerm #> language en #> collate German_Germany.1252 #> tz Europe/Berlin #> date 2018-01-26 #> Packages ----------------------------------------------------------------- #> package * version date source #> backports 1.1.2 2017-12-13 CRAN (R 3.4.3) #> base * 3.4.3 2017-12-06 local #> compiler 3.4.3 2017-12-06 local #> datasets * 3.4.3 2017-12-06 local #> DBI * 0.7 2017-06-18 CRAN (R 3.4.0) #> devtools 1.13.4 2017-11-09 CRAN (R 3.4.2) #> digest 0.6.14 2018-01-14 CRAN (R 3.4.3) #> evaluate 0.10.1 2017-06-24 CRAN (R 3.4.0) #> graphics * 3.4.3 2017-12-06 local #> grDevices * 3.4.3 2017-12-06 local #> htmltools 0.3.6 2017-04-28 CRAN (R 3.4.0) #> knitr 1.18 2017-12-27 CRAN (R 3.4.3) #> magrittr 1.5 2014-11-22 CRAN (R 3.4.2) #> memoise 1.1.0 2018-01-08 Github (hadley/memoise@611cfad) #> methods * 3.4.3 2017-12-06 local #> Rcpp 0.12.15 2018-01-20 CRAN (R 3.4.3) #> rmarkdown 1.8 2017-11-17 CRAN (R 3.4.2) #> RPostgreSQL * 0.6-3 2018-01-24 Github (tomoakin/RPostgreSQL@f93cb17) #> rprojroot 1.3-2 2018-01-03 CRAN (R 3.4.3) #> stats * 3.4.3 2017-12-06 local #> stringi 1.1.6 2017-11-17 CRAN (R 3.4.2) #> stringr 1.2.0 2017-02-18 CRAN (R 3.4.2) #> tools 3.4.3 2017-12-06 local #> utils * 3.4.3 2017-12-06 local #> withr 2.1.1 2017-12-19 CRAN (R 3.4.3) #> yaml 2.1.16 2017-12-12 CRAN (R 3.4.3) ```