[R] MySQL query and character set

Martin Mundschenk m.mundschenk at mundschenk.de
Sat Apr 14 00:02:25 CEST 2007


Hi!

I retrieve data from a MySQL Database, containing special characters  
(german umlaute - äöü).

rs<-dbSendQuery(con,statement=paste("SELECT ...")

The query itself works without problem, but displaying the data  
generates an error at the first line containing such characters.

data<-fetch(rs,n=-1)
data[x]

Whereas the following command works fine:

 > print("öäü")
[1] "öäü"

I assume that the problems are due to the database's character set,  
which is latin1. Unfortunately I could not find any hint how to set  
the right encoding for the database query.

Is anyone familiar with that problem?

Martin


More information about the R-help mailing list