Special characters and RODBC

2019-07-22 04:43发布

in a database I have strings stored that contain special characters such as "§". Using the command

sqlQuery()

from package RODBC "§" is translated to "?". This is also the case for characters such as " ' " as it can be found in French words.

Of course I can not replace every "?" by one of the special characters after the query. Does anybody have an idea for this problem? I work under windows 7.

As requested the out put of sessionInfo()

R version 2.14.1 (2011-12-22)
Platform: x86_64-pc-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] timeDate_2160.97 gridExtra_0.9.1  reshape2_1.2.2   RODBC_1.3-6      ggplot2_0.9.3.1  plyr_1.8        
[7] Runiversal_1.0.2

loaded via a namespace (and not attached):
 [1] colorspace_1.2-1   dichromat_2.0-0    digest_0.6.3       gtable_0.1.2       labeling_0.1       MASS_7.3-21       
 [7] munsell_0.4        proto_0.3-10       RColorBrewer_1.0-5 scales_0.2.3       stringr_0.6.2      tools_2.14.1    

1条回答
啃猪蹄的小仙女
2楼-- · 2019-07-22 05:09

If you are seeing an issue where you are using sqlSave() in R to send to MYSQL where not all of the data streams through, it's likely because of special characters. The key is to make sure the character collation is set to the same in both..I found latin1 works best.

查看更多
登录 后发表回答