到 SQL 服务器(和 Sybase 12.5)的 DBI 连接没有 return 希腊字符
DBI connection to SQL Server (and Sybase 12.5) does not return greek characters
我尝试使用 DBI 包连接到 Sybase 数据库,但查询 return 希腊字符不正确。
与 SQL 服务器的连接相同。下面是一个 dbConnect
命令的例子:
library(odbc)
con <- dbConnect(odbc::odbc(), .connection_string = "Driver={SQL Server};server=ATLAS;database=master;trusted_connection=true")
我在使用 RODBC(具有相同的系统 DSN)时没有遇到任何问题
Table内容:
> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
Matrix products: default
locale:
[1] LC_COLLATE=Greek_Greece.1253 LC_CTYPE=Greek_Greece.1253 LC_MONETARY=Greek_Greece.1253 LC_NUMERIC=C
[5] LC_TIME=Greek_Greece.1253
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] odbc_1.1.1
loaded via a namespace (and not attached):
[1] bit_1.1-12 compiler_3.4.1 hms_0.3 DBI_0.7 tools_3.4.1 tibble_1.3.4 yaml_2.1.14 Rcpp_0.12.12 bit64_0.9-7
[10] blob_1.1.0 rlang_0.1.2
请尝试在 dbConnect()
中设置 encoding
参数。来自 ?odbc::dbConnect
encoding: The text encoding used on the Database. If the database is
the same as your local encoding set to ‘""’. See
‘iconvlist()’ for a complete list of available encodings on
your system. Note strings are always returned ‘UTF-8’
encoded.
我尝试使用 DBI 包连接到 Sybase 数据库,但查询 return 希腊字符不正确。
与 SQL 服务器的连接相同。下面是一个 dbConnect
命令的例子:
library(odbc)
con <- dbConnect(odbc::odbc(), .connection_string = "Driver={SQL Server};server=ATLAS;database=master;trusted_connection=true")
我在使用 RODBC(具有相同的系统 DSN)时没有遇到任何问题
Table内容:
> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
Matrix products: default
locale:
[1] LC_COLLATE=Greek_Greece.1253 LC_CTYPE=Greek_Greece.1253 LC_MONETARY=Greek_Greece.1253 LC_NUMERIC=C
[5] LC_TIME=Greek_Greece.1253
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] odbc_1.1.1
loaded via a namespace (and not attached):
[1] bit_1.1-12 compiler_3.4.1 hms_0.3 DBI_0.7 tools_3.4.1 tibble_1.3.4 yaml_2.1.14 Rcpp_0.12.12 bit64_0.9-7
[10] blob_1.1.0 rlang_0.1.2
请尝试在 dbConnect()
中设置 encoding
参数。来自 ?odbc::dbConnect
encoding: The text encoding used on the Database. If the database is the same as your local encoding set to ‘""’. See ‘iconvlist()’ for a complete list of available encodings on your system. Note strings are always returned ‘UTF-8’ encoded.