DSI
February 16, 2023, 4:20pm
1
Hello,
We have a MySQL database connector. A lot of informations are stored with a wrong encoding.
For example, we have :
- In DB : Démo
- Excepted : Démo
- In DB : dépôt
- Expected : dépôt
We have found a temporary fix by adding convert in SQL request like this :
CONVERT(
CAST(
CONVERT(TABLE.FIELD using latin1) as binary
) USING utf8
) AS 'XXXXXXX'
We can't afford to continue with this fix because this processing would have to be done on every field in our SQL queries.
Hence our request: Is it not possible to add a parameter in the resource to compensate for this? Other ideas?
NB : We can't change encoding in DB because this is on production.
Hi @DSI !
Hmmm. There's no parameter in the resource at the Retool level for this. Do you know if you've been able to use JS to work with your particular encoding before? I wonder if you could just write a JS query that converts an entire query result for you, instead of doing it field by field in SQL.
1 Like
DSI
February 17, 2023, 8:29am
3
Hello,
Thanks for yout quick reply.
We will use :
"return decodeURIComponent(escape({{ QUERY_NAME.rawData['FIELD_NAME'] }}));"
Something like that sounds great! Is that working for you?
As a quick thought, would setting the charset on the resource configuration page be helpful here?
\
DSI
February 27, 2023, 7:32am
7
Hello,
Since then, we have converted the database from Latin1 to utf8mb4.
But we had tested your connection option and that's not working.