The standard UTF-8 character set used by MySQL databases (called utf8) does not truly support all UTF-8 characters - it can only use a maximum of 3 bytes per character. This leaves out the remaining 4-byte characters, including all “emojis” (😕 for example).
Cleaning email subjects using the "MySQL Subject Cleaner" pre-processing task
One of JEMH's great features is its modular pre-processing task system. Particular email processing problems can be overcome by enabling specific tasks to run before the main email processing begins.
The MySQL Subject Cleaner pre-processing task has been added to JEMH. See JEMH-5291 for the versions it was added in. This task filters out 4-byte characters from email subjects, meaning that Jira should not have a problem storing the resulting issue summary. To see what versions this was added in, check the above improvement issue.
To enable the pre-processing task:
Go to the "Auditing" tab in JEMH and expand the "Auditing Enablement" section if it is not already
Click "Enable" to enable JEMH auditing
Go to your JEMH profile and edit the "Email" configuration section
Under the "Pre-processing" section, enable "Use Reprocessed Message"
Select the "MySQL Subject Cleaner" task from the "Pre Processing Tasks" list. If for some reason you need more than one task enabled, control+click to select multiple. Note that processing tasks should only be enabled if you are sure they are needed!
Save changes by clicking "Submit" at the bottom of the page
Cleaning email body content using a Body Cleanup Regular Expression
If your Jira is running on MySQL, unsupported 4-byte characters in the email body could also be a problem. Jira will try to save the content as the description or a comment, and may fail if such characters are present and unsupported. If you suspect this to be the case, you can use the Body Cleanup Regexps setting found under Profile>Email to cut out these characters, allowing successful processing.
It has come to our attention that the previous regular expression suggested ([\uD800-\uDBFF\uDC00-\uDFFF]+) was not correct for Java's regular expression implementation. This incorrectly matched hyphens "-". Please use the above regular expression instead.