thank for your answer,
since the time of question (late november 2018) as i had no solution else remove the accent from database which would have for consequence to change a lot in existing code (in Java,Scheme,Kawa and Haskell) i had used
Database.MySQL.Simple which worked 'out of the box' for accents.
i have checked the locale on both client and server and it is the same:
LANG=en_US.UTF-8
client:
[mattei@asteroide Haskell]$ echo $LANG
en_US.UTF-8
server:
[root@moita ~]# echo $LANG
en_US.UTF-8
if i unset LANG it's worse all accent character display as ? or disappears:
*Main> main
2139
select `NumBD` from 'sidonie.Coordonn?es' where Nom = 'A 20'
*** Exception: SqlError {seState = "", seNativeError = 1064, seErrorMsg = "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''sidonie.Coordonnes' where Nom = 'A 20'' at line 1"}
but the database seems to use latin1 as show below:
MariaDB [sidonie]> SHOW FULL COLUMNS FROM Coordonnées;
+----------------+-------------+-------------------+------+-----+---------+-------+---------------------------------+---------+
| Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment |
+----------------+-------------+-------------------+------+-----+---------+-------+---------------------------------+---------+
| N° Fiche | int(11) | NULL | NO | PRI | 0 | | select,insert,update,references | |
| Alpha 2000 | double | NULL | YES | | NULL | | select,insert,update,references | |
| Delta 2000 | double | NULL | YES | | NULL | | select,insert,update,references | |
| N° ADS | varchar(50) | latin1_swedish_ci | YES | | NULL | | select,insert,update,references | |
| NomSidonie | varchar(50) | latin1_swedish_ci | YES | | NULL | | select,insert,update,references | |
| mag1 | varchar(50) | latin1_swedish_ci | YES | | NULL | | select,insert,update,references | |
| mag2 | varchar(50) | latin1_swedish_ci | YES | | NULL | | select,insert,update,references | |
| N° BD | varchar(50) | latin1_swedish_ci | YES | | NULL | | select,insert,update,references | |
| Spectre | varchar(50) | latin1_swedish_ci | YES | | NULL | | select,insert,update,references | |
| N°Type | float | NULL | YES | | NULL | | select,insert,update,references | |
| N° HIP | varchar(50) | latin1_swedish_ci | YES | | NULL | | select,insert,update,references | |
| Orb | varchar(50) | latin1_swedish_ci | YES | | NULL | | select,insert,update,references | |
| Modif | datetime | NULL | YES | | NULL | | select,insert,update,references | |
| Date de saisie | datetime | NULL | YES | | NULL | | select,insert,update,references | |
| Nom opérateur | varchar(50) | latin1_swedish_ci | YES | | NULL | | select,insert,update,references | |
| Nom | varchar(50) | latin1_swedish_ci | YES | | NULL | | select,insert,update,references | |
+----------------+-------------+-------------------+------+-----+---------+-------+---------------------------------+---------+
16 rows in set (0.00 sec)
i still do not know woth HDBC where to put the options at the connection to set encoding in my code i had this:
do
conn <- connectMySQL defaultMySQLConnectInfo {
mysqlHost = "moita",
mysqlUser = "mattei",
mysqlPassword = ""
}
i can not fin in doc an option for encoding
the solution to do :SET NAMES utf8;
i try this:
config <- quickQuery' conn "SET NAMES utf8" []
but i get an error :
*Main> main
*** Exception: SqlError {seState = "", seNativeError = 2053, seErrorMsg = "Attempt to read a row while there is no result set associated with the statement"}
because SET return an empty result list,
do not know how to make it work....
Damien