odbc
odbc copied to clipboard
The Encoding of the column names is not UTF-8
Issue Description and Expected Result
When the SQL contains non-ASCII strings as the field names, the returned column names of the data.frame is not encoded as UTF-8.
Database
SQL Server 2014
Reproducible Example
Example:
library(odbc)
library(DBI)
con <- dbConnect(odbc::odbc(), dsn = "SQL Server")
x <- DBI::dbGetQuery(con, "select '汉语' as 中文")
Encoding(x[[1]]) # returns UTF-8
Encoding(colnames(x)) # returns unknown and are actually not UTF-8 encoded
