Special characters and RODBC

大兔子大兔子 提交于 2019-12-11 02:57:28

问题


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:


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.



来源:https://stackoverflow.com/questions/18638202/special-characters-and-rodbc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!