-2

I'm running R connecting via RODBC.
No matter what I try, the query result shows ????? for Greece characters.

library(RODBC)
imp <- odbcConnect("DTM_SQL_SERVER", uid = "*********", pwd="******",DBMSencoding="utf8")
msg_recus<-sqlQuery(imp,"select * from mabase;")
libelle : avene-????se t? ?????! - 2015_10_28

original text i would like: AVENE-Νίκησε το Χρόνο! - 2015_10_28

Thanks for your answer

Joris Meys
  • 106,551
  • 31
  • 221
  • 263
Agathe
  • 1
  • 2
  • 1
    The encoding won't be UTF8 then. But without access to the database it's impossible to figure out which one it is exactly. If you're on a Windows system, try DBMSencoding = 'latin1'. If that doesn't do it, you'll have to look up which actual encoding is used in the database. – Joris Meys Jan 28 '16 at 16:36
  • DBMSencoding = 'latin1' : doesn't work so in the database the column's type is nvarchar(128) – Agathe Jan 29 '16 at 10:23
  • doesn't work means you get an error or you get the exact same result? – Joris Meys Jan 29 '16 at 12:52
  • I get the exact same result – Agathe Jan 29 '16 at 13:10
  • Try the solutions here: http://stackoverflow.com/questions/12869778/fetching-utf-8-text-from-mysql-in-r-returns – Joris Meys Jan 29 '16 at 19:22
  • I already try but I don't know how to do it : For RODBC, connect using CharSet=utf8 in the DSN string – Agathe Feb 03 '16 at 14:47
  • And in the end i don't use mysql . I just have R and SQL server 2008 where i can see: AVENE-Νίκησε το Χρόνο! - 2015_10_28 but I just can't seem to get this in R – Agathe Feb 10 '16 at 09:39

1 Answers1

0

Multiple question marks usually derives from

  • you had utf8-encoded data (good)
  • SET NAMES latin1 was in effect (default, but wrong)
  • the column was declared CHARACTER SET latin1 (default, but wrong)

Are you sure the DBMSencoding="utf8" is right for connecting to MySQL? (That should cover for SET NAMES utf8.)

Rick James
  • 135,179
  • 13
  • 127
  • 222
  • I tried something: i have used the basic function read.csv2 to read my label in R. I have the exactly same label : avene-?????? ?? ?????! - 2015_10_28 – Agathe Feb 04 '16 at 15:03
  • The question marks you are reading is what is in the table -- the orignal characters are lost. Have you change the table declaration? Have you re-inserted the data? – Rick James Feb 04 '16 at 16:29
  • I 've just tried to see if the problem is reproducible. But in SQL server 2008 my real original data i can see : AVENE-Νίκησε το Χρόνο! - 2015_10_28 – Agathe Feb 10 '16 at 09:34
  • The question marks usually are cause by mis-configuration during the `INSERT`. – Rick James Feb 12 '16 at 16:31
  • I dont have any insert anywhere. I just connect to my base with odbcConnect and extract some data from a table – Agathe Feb 15 '16 at 13:37