[R-sig-DB] MySQL R Encoding Utf8
Tomoaki NISHIYAMA
tomo@k|n @end|ng |rom kenroku@k@n@z@w@-u@@c@jp
Thu Feb 9 01:20:38 CET 2012
Hi,
dbGetQuery(t.con, "SET NAMES 'utf8'")
before dbSendQuery(t.con, t.sql)
and fetch()
might work.
http://dev.mysql.com/doc/refman/5.6/en/charset-connection.html
You might alternatively change the default values for these
character_set_* variables in MySQL database.
--
Tomoaki NISHIYAMA
Advanced Science Research Center,
Kanazawa University,
13-1 Takara-machi,
Kanazawa, 920-0934, Japan
On 2012/02/09, at 3:24, Henri Mone wrote:
> Dear R Users and Experts,
>
> I got a MySQL table with German special characters (umlaute like ��,��,��
> etc.) . The MySQL database table is in the UTF8 format, and if I
> submit a query over the MySql client the umlaute are displayed
> correctly. If I submit the same query via R the umlaute are displayed
> wrong. That is a little confusing for me, R as well as the MySQL
> support UTF8.
> Is there any option which I should use to get the umlaute in R correct?
>
> Thanks,
> Henri
>
>
>> t.m <-dbDriver("MySQL")
>> t.con <- try(dbConnect(t.m))
>> t.rs <- try(dbSendQuery(t.con, t.sql))
>> t.data <- fetch(t.rs,-1)
>> t.data # correct would be "��sterreichische Schilling"
> \xd6sterreichische Schilling
> ...
>
[[alternative HTML version deleted]]
More information about the R-sig-DB
mailing list