From a7f28383b59b10d99ab9079b348608bc7d0916fb Mon Sep 17 00:00:00 2001 From: ECYaz Date: Mon, 27 Jul 2026 09:07:23 -0400 Subject: [PATCH] Allow emoji in attention titles and descriptions Reporting a post or a contribution writes the subject and the reason straight into attention_title and attention_description. Unlike the message fields these never pass through the text formatter, so a four byte character such as an emoji reaches the utf8 columns as-is and MySQL rejects the row: Incorrect string value: '\xF0\x9F\x86\x95 t...' for column 'attention_title' at row 1 [1366] Replace those characters with their numeric character reference on the way in, using the same utf8_encode_ucr() core applies to report text. Doing it in submit() covers all three places that create attention rows. Nothing needs decoding on the way out, since a character reference renders as the character it stands for. Rows written before this change are unaffected, and the encoding is stable if it is applied to text that already carries one. --- includes/objects/attention.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/includes/objects/attention.php b/includes/objects/attention.php index 6c8b8832d..9e53685d6 100644 --- a/includes/objects/attention.php +++ b/includes/objects/attention.php @@ -111,6 +111,12 @@ public function submit() ); } + // Emojis and other four byte characters are not allowed by MySQL in the + // utf8 columns these are stored in, so replace them with their numeric + // character reference, as core does for report text. + $this->attention_title = utf8_encode_ucr($this->attention_title); + $this->attention_description = utf8_encode_ucr($this->attention_description); + parent::submit(); }