Defect #30848
openError when creating issue with emoji in description
0%
Description
When creating issue with emoji in description, it will return error. Here is the log:
[[Completed 500 Internal Server Error in 54ms (ActiveRecord: 12.9ms)
ActiveRecord::StatementInvalid (Mysql2::Error: Incorrect string value: '\xF0\x9F\x98\x84\xF0\x9F...' for column 'description' at row 1:
INSERT INTO `issues` (`tracker_id`, `project_id`, `subject`, `description`, `status_id`, `priority_id`, `author_id`, `created_on`, `upda
ted_on`, `start_date`, `lock_version`) VALUES (14, 111, 'Tes Emoji', 'Test <U+1F604><U+1F604><U+1F604>', 1
, 2, 39, '2019-02-20 13:39:02', '2019-02-20 13:39:02', '2019-02-20', 0)):
]]
Related issues
Updated by Marius BÄ‚LTEANU over 5 years ago
- Related to Feature #31921: Changes to properly support 4 byte characters (emoji) when database is MySQL added
Updated by Erik Moeller about 4 years ago
We can reproduce this on our Redmine 4.0.7 setup, with an emoji in the title of the issue.
Updated by Mischa The Evil about 3 years ago
- Related to Defect #35879: mail handler failing when smilies inline added
Updated by Anatoly P about 1 year ago
Up
Can reproduce it on our 5.0.5.stable
And here www.redmine.org
I convert db and all my tables to `utf8mb4` / `utf8mb4_unicode_ci` in (10.5-MariaDB)
But i still cant use emoji :-(
Updated by Holger Just about 1 year ago
MySQL / MariaDB stores encoding and collations in various places, including as a database default, table default, and for each column separately. Thus, if you have an existing database, you need to transfer each text / varchar column to utf8mb4 separately.
Updated by Anatoly P about 1 year ago
I changed the encoding to `utf8mb4_general_ci` in every place where you can select the encoding. And in the database and in every table and in every vchar/text/long field, and still I see error 500 when I try to add emoji to any field.
I also see error 500 right here on https://www.redmine.org/ when I try to create any record with emoji.
Updated by Andrei Melis about 2 months ago
I was able to fix this by setting REDMINE_DB_ENCODING=utf8mb4 in the docker image env, plus altering the collation of existing database and tables:
ALTER DATABASE redmine DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ALTER TABLE issues CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ALTER TABLE journals CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ALTER TABLE journal_details CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
If you don't use Docker, you should probably check the config/database.yml file:
production: adapter: "mysql2" host: "mysql" port: "3306" username: "redmine" password: "secret" database: "redmine" encoding: "utf8mb4"