Allow emoji in attention titles and descriptions - #439
Open
ECYaz wants to merge 1 commit into
Open
Conversation
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.
ECYaz
force-pushed
the
fix/371-emoji-attention
branch
from
July 27, 2026 13:07
9b9cfb3 to
a7f2838
Compare
This was referenced Jul 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #371.
Reporting a post or a contribution writes the subject and the reason straight into
attention_titleandattention_description. Unlike the message fields these never pass through the text formatter, so a four byte character such as an emoji reaches theutf8columns as-is and MySQL rejects the row:This uses
utf8_encode_ucr()on the way in, the same thing core does to report text inphpbb\report\controller\report, per @iMattPro's suggestion on #390. Doing it intitania_attention::submit()covers all three places that create attention rows rather than patching each one.Nothing needs decoding on the way out, since a character reference renders as the character it stands for.
Checked on a local board:
The columns could instead be moved to
utf8mb4, but the driver connects withSET NAMES 'utf8', so the insert still fails at the connection before the column charset applies. That is PHPBB-16137, still awaiting review.