[R-sig-DB] rodbc reading Cyrllic from MS Access datatable

Fischbach, Anthony @||@chb@ch @end|ng |rom u@g@@gov
Thu Feb 27 21:29:42 CET 2014


I have an MS Access database with fields in both English and Russian (e.g.
"Name", "������� ��������") and wish to read this into r.
I have tried the following lines, but find that my Russian Cyrllic
characters are not retained.

> data.ch<-odbcConnectAccess("D:/fakePath/MyDataBase.mdb" )
> Tbl<-sqlFetch(data.ch, "MyTable")
> Tbl[1:5, c(2,4)]
                    Name                                 ??????? ????????
1            Belyak Spit ???? ?????? ? 6 ?? ? ? ?? ????? ??????????? ????
2       Bogoslava Island                                 ?????? ?????????
3 Bol'shoy Routan Island                            O????? ??????? ??????
4       Burunnye Islands                                 ??????? ????????
5           Cape Blossom                                      ??? ???????

I have tried using the DBMSencoding options with values of 'UTF-8'  but
received the same results.  When I tried this with the value of and
'UCS-2', I received an error (listed below).

Error in iconv(tablename, to = enc) :
  embedded nul in string:
'��\0H\0a\0u\0l\0o\0u\0t\0L\0o\0c\0a\0t\0i\0o\0n\0s\0_\0t\0b\0l'

I have tried doing the import from both .mdb and .accdb copies of the MS
Access database using the appropriate odbcConnectAccess2007, with the same
results.

The problem is not with r representing the Cyrllic, because I may read the
same table in from a csv format and retain the Cyrllic names (see snippet
below).

> Tbl.fromCSV<-read.csv(file='D:/fakePath/MyTable.csv', stringsAsFactors=F,
encoding = 'UTF-8')
> Tbl.fromCSV[1:5, c(2,4)]
                    Name                                 �������.��������
1            Belyak Spit ���� ������ � 6 �� � � �� ����� ����������� ����
2       Bogoslava Island                                 ������ ���������
3 Bol'shoy Routan Island                            O����� ������� ������
4       Burunnye Islands                                 ������� ��������
5           Cape Blossom                                      ��� �������

Any help appreciated.

> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: i386-w64-mingw32/i386 (32-bit)

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

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

other attached packages:
[1] RODBC_1.3-10  plotKML_0.4-2 rgdal_0.8-16  sp_1.0-14

loaded via a namespace (and not attached):
 [1] aqp_1.6             class_7.3-9         classInt_0.1-21
cluster_1.14.4      colorRamps_2.3      colorspace_1.2-4    dichromat_2.0-0
    dismo_0.9-3         e1071_1.6-2         Formula_1.1-1
[11] grid_3.0.1          gstat_1.0-18        Hmisc_3.14-1
 intervals_0.14.0    labeling_0.2        lattice_0.20-24
latticeExtra_0.6-26 munsell_0.4.2       pixmap_0.4-11       plotrix_3.5-3

[21] plyr_1.8.1          raster_2.2-12       RColorBrewer_1.0-5
 Rcpp_0.11.0         reshape_0.8.4       RSAGA_0.93-6        scales_0.2.3
     spacetime_1.0-9     splines_3.0.1       stringr_0.6.2
[31] survival_2.37-7     tools_3.0.1         XML_3.98-1.1        xts_0.9-7
          zoo_1.7-10
>


Anthony Fischbach, Wildlife Biologist
USGS Alaska Science Center Walrus Research Program
4210 University Drive (Glen Olds Hall room 369)
Anchorage, AK 99508

voice: (907) 786-7145

http://alaska.usgs.gov/science/biology/walrus/

	[[alternative HTML version deleted]]




More information about the R-sig-DB mailing list