I wanted to change the label of a column in a report to an emoji to save space when using the report in a Dashboard Dashlet. After saving the report with an emoji in the column label I get no line item results. After checking suitecrm.log I see the following fatal error:
Query Failed: SELECT `cases`.id AS 'ID_😀0', `cases`.id AS 'cases_id' FROM `cases` WHERE cases.deleted = 0 LIMIT 0,60: MySQL error 3854: Cannot convert string 'ID_\xF0\x9F\x98...' from utf8mb4 to utf8mb3
I have MySQL 8.0.31 running in AWS RDS which is what SuiteCRM 7 is using. I recently set up the database to accept utf8mb4 and tested entering emojis into table data. For instance, I can successfully copy-paste an emoji into an Account name and save it to the database table, recall that data in a detail view and list view without issue.
For some reason, MySQL won’t accept the query:
SELECT count(*) c FROM (SELECT `cases`.id AS 'ID_😀0', `cases`.id AS 'cases_id' FROM `cases` WHERE cases.deleted = 0 ) AS n;
but the following query is just fine:
SELECT count(*) c FROM (SELECT `cases`.id AS 'ID_test0', `cases`.id AS 'cases_id' FROM `cases` WHERE cases.deleted = 0 ) AS n;
I know this isn’t specifically a SuiteCRM issue; I get the error when connected directly to the MySQL database with HeidiSQL. Since using emojis as column labels seems like a valid and useful thing to do in SuiteCRM I’m hoping someone here can shed some light on how this can be resolved.
Can MySQL be configured to accept the emoji in the query?
Why is my MySQL instance trying to convert the query (or results) to utf8mb3? Can that be changed?
Will this never work and SuiteCRM needs to re-encode the emojis so they’re not sent to MySQL in a query?
Thanks!