Accented characters in an SQL query

Hello,

In SQL queries, I have accented characters that do not pass through at runtime.
My rmd file is in UT8.
I use PostgreSQL, and RpostgreSQL .

Here is the error

Error in postgresqlExecStatement(conn, statement, ...) : 
  RS-DBI driver: (could not Retrieve the result : ERREUR:  séquence d'octets invalide pour l'encodage « UTF8 » : 0xe9 0x74 0x61

and the query

sql<-("
 WITH a AS (
SELECT res_ann,res_moi,prd
 prd, res_exp, 
CASE
WHEN res_tinh =0 then 'Bétalactames'
WHEN res_tinh =1 then 'Tétracyclines'
END AS  molecule
FROM matable) 
SELECT res_ann,res_moi, prd,molecule,count(*) 
FROM a
WHERE molecule IS NOT NULL
GROUP BY res_ann,res_moi, prd,molecule
ORDER BY res_ann, res_moi, prd")

db<-con()

antibio <- ""
antibio <- dbGetQuery(db,sql)
dbDisconnect(db)

thanks for your help

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.